/**
 * Shared CSS - 共用樣式系統
 * 此檔案包含在多個頁面中共用的樣式
 */

/* ========================================
   Color Variables - 色彩變數
   ======================================== */
:root {
  /* Primary Colors - 主題色 */
  --color-primary: #1ABC9C;
  --color-primary-dark: #16A085;
  --color-primary-light: #48C9B0;
  --color-primary-pale: #D5F4EC;

  /* Neutral Colors - 中性色 */
  --color-text-primary: #2D3748;
  --color-text-secondary: #718096;
  --color-text-muted: #A0AEC0;
  --color-border: #E2E8F0;
  --color-border-dark: #CBD5E0;

  /* Background Colors - 背景色 */
  --color-bg-white: #FFFFFF;
  --color-bg-light: #F7FAFC;
  --color-bg-grey: #EDF2F7;

  /* Status Colors - 狀態色 */
  --color-success: #48BB78;
  --color-error: #F56565;
  --color-warning: #ED8936;
  --color-info: #4299E1;

  /* Shadows - 陰影 */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Border Radius - 圓角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions - 過渡動畫 */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ========================================
   Typography - 排版
   ======================================== */
.text-primary {
  color: var(--color-text-primary) !important;
}

.text-secondary {
  color: var(--color-text-secondary) !important;
}

.text-muted {
  color: var(--color-text-muted) !important;
}

.text-brand {
  color: var(--color-primary) !important;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* ========================================
   Buttons - 按鈕樣式 (Pixieset Style)
   ======================================== */
/* Base Button */
.btn {
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  border: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  transition: background-color 0.3s ease-out, color 0.3s ease-out, box-shadow 0.2s ease;
  display: inline-block;
  position: relative;
  text-decoration: none;
  line-height: 1;
}

/* Primary Button - Pixieset Green */
.btn-primary {
  color: #ffffff;
  background-color: #1abc9c;
  padding: 0 24px;
  height: 40px;
  line-height: 40px;
  box-shadow: 0 2px 8px rgba(26, 188, 156, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
  color: #ffffff;
  background-color: #13987e;
  outline: 0;
  box-shadow: 0 4px 12px rgba(26, 188, 156, 0.3);
}

.btn-primary:active {
  background-color: #0f7b67;
  box-shadow: 0 1px 4px rgba(26, 188, 156, 0.2);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Secondary Button - Gray */
.btn-secondary {
  color: #5f5f5f;
  background-color: #f1f1f1;
  padding: 0 24px;
  height: 40px;
  line-height: 40px;
}

.btn-secondary:hover,
.btn-secondary:focus {
  color: #5f5f5f;
  background-color: #ebebeb;
  outline: 0;
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Sizes */
.btn-sm {
  height: 32px;
  padding: 0 16px;
  line-height: 32px;
  font-size: 13px;
}

.btn-md {
  height: 40px;
  padding: 0 24px;
  line-height: 40px;
}

.btn-lg {
  height: 48px;
  padding: 0 32px;
  line-height: 48px;
  font-size: 15px;
}

/* Legacy Support - keep old classes for backward compatibility */
.btn-primary-custom {
  background-color: var(--color-primary);
  border: none;
  color: white;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-primary-custom:hover {
  background-color: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: white;
}

.btn-primary-custom:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary-custom:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Social Login Button - 社交登入按鈕 */
.btn-social {
  background-color: var(--color-bg-white);
  border: 2px solid var(--color-border);
  color: var(--color-text-primary);
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-decoration: none;
  width: 100%;
}

.btn-social:hover {
  background-color: var(--color-bg-light);
  border-color: var(--color-border-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--color-text-primary);
  text-decoration: none;
}

.btn-social:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-social-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Secondary Button - 次要按鈕 */
.btn-secondary-custom {
  background-color: transparent;
  border: 2px solid var(--color-border);
  color: var(--color-text-primary);
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-secondary-custom:hover {
  background-color: var(--color-bg-light);
  border-color: var(--color-border-dark);
  color: var(--color-text-primary);
  text-decoration: none;
}

/* ========================================
   Cards & Containers - 卡片與容器
   ======================================== */
.card-custom {
  background-color: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-custom-xl {
  padding: 3rem 2.5rem;
  border-radius: var(--radius-xl);
}

/* Glass Effect - 毛玻璃效果 */
.glass-effect {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ========================================
   Form Elements - 表單元素
   ======================================== */
.input-custom {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--color-text-primary);
  transition: all var(--transition-base);
  background-color: var(--color-bg-white);
}

.input-custom:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-pale);
}

.input-custom::placeholder {
  color: var(--color-text-muted);
}

/* ========================================
   Links - 連結
   ======================================== */
.link-primary {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.link-primary:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.link-muted {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.link-muted:hover {
  color: var(--color-text-secondary);
}

/* ========================================
   Dividers - 分隔線
   ======================================== */
.divider-text {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.divider-text::before {
  margin-right: 1rem;
}

.divider-text::after {
  margin-left: 1rem;
}

/* ========================================
   Utilities - 工具類
   ======================================== */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.w-100 {
  width: 100%;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mt-4 {
  margin-top: 2rem;
}

.py-1 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-2 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.px-2 {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ========================================
   Animations - 動畫
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   Container & Layout - 容器與佈局
   ======================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-sm {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-xs {
  max-width: 576px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ========================================
   Modal & Overlay - 模態框與覆蓋層
   ======================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.modal-close-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background-color: var(--color-bg-grey);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background-color: var(--color-error);
  color: white;
}

/* ========================================
   Loading States - 載入狀態
   ======================================== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s ease-in-out infinite;
}

.loading-spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* ========================================
   File Upload Components - 檔案上傳組件
   ======================================== */
.file-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  background-color: var(--color-bg-white);
  cursor: pointer;
  transition: all var(--transition-base);
}

.file-upload-zone:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-pale);
}

.file-upload-zone.dragover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-pale);
  transform: scale(1.02);
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-bg-light);
}

.file-preview-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background-color: var(--color-bg-grey);
}

.file-preview-info {
  flex: 1;
  min-width: 0;
}

.file-preview-name {
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 0.25rem 0;
}

.file-preview-size {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

.file-remove-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background-color: var(--color-error);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.file-remove-btn:hover {
  background-color: var(--color-error);
  transform: scale(1.1);
}

/* ========================================
   Alert & Notification - 警告與通知
   ======================================== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-success {
  background-color: rgba(72, 187, 120, 0.1);
  border-color: var(--color-success);
  color: var(--color-success);
}

.alert-error {
  background-color: rgba(245, 101, 101, 0.1);
  border-color: var(--color-error);
  color: var(--color-error);
}

.alert-warning {
  background-color: rgba(237, 137, 54, 0.1);
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.alert-info {
  background-color: rgba(66, 153, 225, 0.1);
  border-color: var(--color-info);
  color: var(--color-info);
}

/* ========================================
   Progress Bars - 進度條
   ======================================== */
.progress {
  width: 100%;
  height: 8px;
  background-color: var(--color-bg-grey);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--color-primary);
  transition: width var(--transition-base);
  border-radius: var(--radius-sm);
}

.progress-striped .progress-bar {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
  0% { background-position: 1rem 0; }
  100% { background-position: 0 0; }
}

/* ========================================
   Tooltips - 工具提示
   ======================================== */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: var(--color-text-primary);
  color: var(--color-bg-white);
  text-align: center;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  font-size: 0.875rem;
}

.tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--color-text-primary) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ========================================
   Responsive Design - 響應式設計
   ======================================== */
@media (max-width: 768px) {
  .container,
  .container-sm,
  .container-xs {
    padding: 0 0.75rem;
  }
  
  .modal-content {
    padding: 1.5rem;
  }
  
  .file-upload-zone {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 576px) {
  .card-custom {
    padding: 2rem 1.5rem;
    border-radius: var(--radius-md);
  }

  .btn-primary-custom,
  .btn-secondary-custom {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }

  .btn-social {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }
  
  .modal-content {
    padding: 1rem;
    margin: 1rem;
  }
  
  .file-preview {
    flex-direction: column;
    text-align: center;
  }
  
  .file-preview-image {
    align-self: center;
  }
}
