/* ================================================
   新設計樣式 - 手機優先 (2025-01-07)
   ================================================ */

:root {
  --gradient-primary: linear-gradient(135deg, #7c7bf0 0%, #e05d8f 50%, #d94371 100%);
  --gradient-light: linear-gradient(135deg, rgba(124, 123, 240, 0.08) 0%, rgba(224, 93, 143, 0.08) 100%);
  --color-primary: #7c7bf0;
  --color-accent: #e05d8f;
  --color-dark: #2d3436;
  --color-text: #2d3436;
  --color-text-light: #636e72;
  --color-border: #e1e8ed;
  --color-border-focus: #7c7bf0;
  --timing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.15);
  --shadow-button: 0 8px 24px rgba(124, 123, 240, 0.35);
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* 頁首 */
.header {
  text-align: center;
  padding: 1.5rem 1rem 1.5rem;
  animation: fadeInDown 0.6s var(--timing-smooth);
}

.header .logo {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: 2px;
  line-height: 1.1;
}

.header .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  margin-top: 0.1rem;
  font-weight: 500;
  line-height: 1.3;
}

/* 主卡片 */
.main-card {
  background: #ffffff;
  backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 2rem 1.5rem 4rem;
  min-height: 500px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  animation: slideInUp 0.6s var(--timing-smooth);
  margin-bottom: 3rem;
  width: 100%;
}

/* 表單容器 - 確保寬度一致 */
#urlform,
#imageform,
#videoform {
  width: 100%;
  min-height: 400px;
}

/* 上傳區域 - 確保寬度一致 */
.upload-area {
  width: 100%;
  box-sizing: border-box;
}

/* 結果顯示區 - 確保寬度一致 */
.result-container {
  width: 100%;
  box-sizing: border-box;
}

/* Tab 切換 - 大圖示 */
.function-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 20px;
  position: relative;
  border: 2px solid var(--color-border);
}

.function-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.75rem 0.5rem;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s var(--timing-smooth);
  position: relative;
  z-index: 1;
  text-align: center;
}

.function-tab i {
  font-size: 1.5rem;
  display: block !important;
  color: var(--color-text-light);
  transition: all 0.3s var(--timing-smooth);
  margin-bottom: 0.25rem;
}

.function-tab span {
  display: block !important;
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 0.25rem;
  font-weight: 600;
  transition: all 0.3s var(--timing-smooth);
  visibility: visible !important;
  opacity: 1 !important;
}

.function-tab.active {
  background: white;
  box-shadow: 0 4px 16px rgba(124, 123, 240, 0.2),
              0 0 0 2px var(--color-primary);
}

.function-tab.active i {
  color: var(--color-primary);
  transform: scale(1.15);
}

.function-tab.active span {
  color: var(--color-primary);
  font-weight: 700;
}

/* 超大輸入框 */
.mega-input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.mega-input {
  width: 100%;
  border: 3px solid var(--color-border);
  border-radius: 20px;
  padding: 1.5rem 1.25rem;
  font-size: 1.1rem;
  transition: all 0.3s var(--timing-smooth);
  background: white;
  outline: none;
}

.mega-input:hover {
  border-color: #c7d0d9;
}

.mega-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(124, 123, 240, 0.2),
              0 8px 24px rgba(124, 123, 240, 0.15);
  transform: scale(1.01);
}

.mega-input::placeholder {
  color: #adb5bd;
}

.mega-input.input-error {
  border-color: #dc3545;
  background-color: #fff5f5;
}

.mega-input.input-error:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2),
              0 8px 24px rgba(220, 53, 69, 0.15);
}

.input-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--color-primary);
  opacity: 0;
  transition: opacity 0.3s;
}

.mega-input:focus + .input-icon {
  opacity: 1;
}

/* URL 驗證錯誤訊息 */
.url-validation-error {
  color: #dc3545;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #fff5f5;
  border-left: 3px solid #dc3545;
  border-radius: 8px;
  animation: slideDown 0.3s var(--timing-smooth);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 說明輸入框 */
.description-input {
  width: 100%;
  border: 2px solid var(--color-border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  transition: all 0.3s var(--timing-smooth);
  margin-bottom: 1.5rem;
  outline: none;
}

.description-input:hover {
  border-color: #c7d0d9;
}

.description-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 123, 240, 0.2);
}

/* 快捷設定 - 底部浮動 */
.quick-settings {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0.5rem 0.75rem;
  margin: 0 -1rem 1.5rem -1rem;
  width: calc(100% + 2rem);
  justify-content: center;
}

.quick-settings::-webkit-scrollbar {
  height: 4px;
}

.quick-settings::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 2px;
}

.quick-btn {
  flex-shrink: 0;
  padding: 0.875rem 1.25rem;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.3s var(--timing-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 90px;
  white-space: nowrap;
}

.quick-btn:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(124, 123, 240, 0.15);
  transform: translateY(-2px);
}

.quick-btn i {
  font-size: 1.5rem;
  color: var(--color-accent);
  transition: all 0.3s var(--timing-smooth);
}

.quick-btn-label {
  font-size: 0.875rem;
  color: var(--color-text);
  font-weight: 600;
  transition: all 0.3s var(--timing-smooth);
  display: block;
}

.quick-btn-value {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-weight: 500;
  margin-top: 0.15rem;
  display: block;
  transition: all 0.3s var(--timing-smooth);
}

.quick-btn.active {
  background: var(--gradient-light);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 123, 240, 0.2),
              0 4px 12px rgba(124, 123, 240, 0.25);
}

.quick-btn.active i {
  color: var(--color-primary);
  transform: scale(1.1);
}

.quick-btn.active .quick-btn-label {
  color: var(--color-primary);
  font-weight: 700;
}

.quick-btn.active .quick-btn-value {
  color: var(--color-primary);
  font-weight: 600;
}

.quick-btn:active {
  transform: scale(0.95);
}

/* 超大生成按鈕 */
.mega-button {
  width: 100%;
  background: var(--gradient-primary);
  background-size: 200% 100%;
  border: none;
  border-radius: 20px;
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.4s var(--timing-smooth);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(124, 123, 240, 0.4),
              0 4px 16px rgba(224, 93, 143, 0.3);
  margin-bottom: 1rem;
}

.mega-button:hover {
  box-shadow: 0 12px 40px rgba(124, 123, 240, 0.5),
              0 6px 20px rgba(224, 93, 143, 0.4);
  transform: translateY(-2px);
}

.mega-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.mega-button:active {
  transform: scale(0.97);
}

.mega-button:hover::before {
  width: 400px;
  height: 400px;
}

.btn-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.btn-icon {
  font-size: 1.5rem;
  animation: pulse-btn 2s infinite;
}

@keyframes pulse-btn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* 進階設定連結 */
.advanced-link {
  text-align: center;
  margin-top: 1rem;
}

.advanced-link button {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.5rem 1rem;
  transition: all 0.3s var(--timing-smooth);
}

.advanced-link button:hover {
  color: var(--color-accent);
  transform: scale(1.05);
}

/* 底部抽屜 */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 52, 54, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--timing-smooth);
}

.drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 0 0 32px 32px;
  padding: 1.5rem 1.5rem 2.5rem;
  max-height: 95vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(-100%);
  transition: transform 0.4s var(--timing-smooth);
  z-index: 1001;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.drawer.show {
  transform: translateY(0);
}

.drawer-header {
  position: relative;
  margin-bottom: 1.5rem;
}

.drawer-handle {
  width: 48px;
  height: 5px;
  background: var(--color-border);
  border-radius: 3px;
  margin: 0 auto 1rem;
}

.drawer-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 0;
  text-align: center;
  background: var(--gradient-light);
  padding: 0.75rem 3rem;
  border-radius: 16px;
  border: 2px solid var(--color-border);
}

.drawer-close {
  position: absolute;
  top: 3rem;
  right: 0;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 0.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s var(--timing-smooth);
}

.drawer-close:hover {
  background: rgba(124, 123, 240, 0.1);
  color: var(--color-primary);
  transform: rotate(90deg);
}

.setting-item {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 16px;
  border: 2px solid var(--color-border);
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.setting-label i {
  color: var(--color-primary);
  font-size: 1.25rem;
}

.setting-input {
  width: 100%;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  transition: all 0.3s;
  background: white;
}

.setting-input:hover {
  border-color: #c7d0d9;
}

.setting-input:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 123, 240, 0.2);
}

/* 密碼快選 */
.password-quick {
  margin-top: 0.75rem;
}

.password-quick button {
  width: 100%;
  padding: 0.875rem;
  border: 2px solid var(--color-primary);
  border-radius: 12px;
  background: var(--gradient-light);
  color: var(--color-dark);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--timing-smooth);
}

.password-quick button:hover {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(124, 123, 240, 0.15) 0%, rgba(224, 93, 143, 0.15) 100%);
  box-shadow: 0 4px 12px rgba(124, 123, 240, 0.2);
  transform: translateY(-1px);
}

.password-quick button:active {
  background: var(--gradient-primary);
  color: white;
  transform: scale(0.97);
}

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

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 響應式 - 平板 */
@media (min-width: 768px) {
  .main-card {
    max-width: 600px;
    width: 600px;
    margin: 0 auto 3rem;
    border-radius: 32px;
    min-height: 500px;
  }

  .header {
    padding: 2rem 1rem 2rem;
  }

  .header .logo {
    font-size: 2.5rem;
  }

  .mega-input {
    font-size: 1.2rem;
    padding: 1.75rem 1.5rem;
  }

  .mega-button {
    font-size: 1.35rem;
    padding: 1.75rem;
  }

  /* 桌面版抽屜 - 不滿版，從頂部顯示 */
  .drawer {
    max-width: 600px;
    left: 50%;
    top: 20px;
    right: auto;
    transform: translate(-50%, -100%);
    border-radius: 32px;
    max-height: 90vh;
    padding: 2rem 2rem 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(124, 123, 240, 0.1);
  }

  .drawer.show {
    transform: translate(-50%, 0);
  }

  .drawer-close {
    top: 3.5rem;
    right: 0.5rem;
  }

  .drawer-overlay {
    background: rgba(45, 52, 54, 0.7);
  }

  .function-tab {
    padding: 1rem 0.75rem;
  }

  .function-tab i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .function-tab span {
    display: block !important;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* 響應式 - 桌面 */
@media (min-width: 1200px) {
  .main-card {
    max-width: 700px;
    width: 700px;
  }

  .drawer {
    max-width: 700px;
  }
}

/* 小提示標籤 */
.badge-hint {
  display: inline-block;
  background: var(--gradient-light);
  color: var(--color-primary);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
  border: 1px solid rgba(124, 123, 240, 0.3);
}
