/* ===================================
   Cinematic Enterprise Luxury Design System
   电影质感企业奢华设计 - 深邃、精致、专业
   Inspired by Giga AI
   =================================== */

/* 字体导入 - Serif + Sans-serif 组合 */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ===================================
   Design Tokens - 统一深色主题
   =================================== */
:root {
    /* 背景色 - Deep Charcoal Slate */
    --bg-deep: #141619;           /* 主背景 - 深板岩炭 */
    --bg-base: #141619;           /* 基础背景 */
    --bg-subtle: #1a1d21;         /* 微妙层次 */
    --bg-muted: #22262b;          /* 柔和层次 */
    --bg-emphasis: #1e2126;       /* 强调背景 */

    /* 表面色 - Card & Container */
    --surface-card: rgba(30, 33, 38, 0.9);     /* 卡片背景 */
    --surface-elevated: rgba(34, 38, 43, 0.95); /* 悬浮层 */
    --surface-hover: rgba(40, 44, 50, 0.95);    /* 悬停状态 */
    --surface-active: rgba(50, 55, 62, 0.95);   /* 激活状态 */
    --surface-glass: rgba(20, 22, 25, 0.85);    /* 玻璃效果 */

    /* 主色调 */
    --primary: #ffffff;           /* 白色 - 主CTA */
    --primary-hover: #f0f0f0;     /* 白色悬停 */
    --secondary: #22262b;         /* 次要色 */
    --accent: #f05a4a;            /* 珊瑚红强调色 */
    --accent-light: #ff7a6b;      /* 浅珊瑚 */
    --accent-dark: #d94a3a;       /* 深珊瑚 */

    /* 渐变 */
    --gradient-overlay: linear-gradient(180deg, transparent 0%, #141619 100%);
    --gradient-subtle: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
    --gradient-accent: linear-gradient(135deg, #f05a4a 0%, #ff7a6b 100%);
    --gradient-dark: linear-gradient(180deg, #1a1d21 0%, #141619 100%);

    /* 边框 */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-default: rgba(255, 255, 255, 0.15);
    --border-focus: rgba(240, 90, 74, 0.5);
    --border-card: 1px solid rgba(255, 255, 255, 0.08);

    /* 文字 */
    --text-primary: #ffffff;       /* 纯白 - 标题 */
    --text-secondary: #a1a1aa;     /* 柔灰 - 正文 */
    --text-muted: #71717a;         /* 暗灰 - 辅助 */
    --text-accent: #f05a4a;        /* 珊瑚强调 */
    --text-inverse: #141619;       /* 反色 - 按钮文字 */

    /* 阴影 - Cinematic Depth */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 50px -15px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
    --shadow-focus: 0 0 0 3px rgba(240, 90, 74, 0.3);
    --shadow-card: 0 10px 40px -15px rgba(0, 0, 0, 0.5);
    --shadow-lift: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px rgba(240, 90, 74, 0.15);

    /* 状态色 */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;        /* Pill */

    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* 字体 */
    --font-serif: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* 安全区域 */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);

    --header-height: 64px;
    --touch-target: 44px;
}

/* ===================================
   全局重置
   =================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    touch-action: manipulation;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-secondary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.7;
    letter-spacing: -0.01em;
}

/* 背景装饰 - Subtle Gradient Atmosphere */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        /* 顶部微妙高光 */
        radial-gradient(ellipse 100% 50% at 50% -20%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        /* 角落暗色强调 */
        radial-gradient(ellipse 50% 50% at 100% 100%, rgba(240, 90, 74, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 0% 100%, rgba(240, 90, 74, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* 噪点纹理叠加 - Film Grain Effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
}

.page {
    min-height: 100vh;
    min-height: 100dvh;
}

.hidden {
    display: none !important;
}

/* ===================================
   排版系统 - Typography
   =================================== */
h1, h2, h3, .heading-serif {
    font-family: var(--font-serif);
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.heading-sans {
    font-family: var(--font-sans);
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ===================================
   主题切换按钮（隐藏，保留兼容性）
   =================================== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    background: var(--surface-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition-smooth);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-default);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ===================================
   认证页面 - Cinematic Login
   =================================== */
#auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    padding-top: calc(24px + var(--safe-area-top));
    padding-bottom: calc(24px + var(--safe-area-bottom));
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* 背景渐变装饰 */
#auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        /* 中心微妙光晕 */
        radial-gradient(ellipse 80% 60% at 50% 30%, rgba(240, 90, 74, 0.06) 0%, transparent 50%),
        /* 底部渐变 */
        linear-gradient(180deg, transparent 0%, rgba(20, 22, 25, 0.8) 100%);
    pointer-events: none;
    z-index: 0;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    background: var(--surface-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xl);
    animation: authEnter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 1;
}

@keyframes authEnter {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 8px;
    font-family: var(--font-serif);
    font-size: 36px;
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.auth-logo {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(240, 90, 74, 0.2));
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
}

.auth-tabs {
    display: flex;
    margin-bottom: 32px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-full);
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    min-height: 44px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-full);
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    position: relative;
}

.auth-form input {
    width: 100%;
    padding-top: 16px;
    padding-bottom: 16px;
    padding-right: 20px;
    /* padding-left is controlled by Tailwind classes */
    min-height: 52px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    transition: var(--transition-smooth);
}

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

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-focus);
}

.auth-form button[type="submit"] {
    width: 100%;
    padding: 16px 28px;
    min-height: 52px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--text-inverse);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: 8px;
}

.auth-form button[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.auth-form button[type="submit"]:active {
    transform: translateY(0);
}

.error-msg {
    color: var(--error);
    text-align: center;
    font-size: 13px;
    min-height: 20px;
    font-weight: 500;
}

/* 登录分隔线 */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 8px 0;
}

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

.auth-divider span {
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* X 登录按钮 */
.btn-twitter-login {
    width: 100%;
    padding: 0 24px;
    height: 48px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.btn-twitter-login:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-default);
}

.btn-twitter-login:active {
    background: rgba(255, 255, 255, 0.08);
}

.btn-twitter-login:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-twitter-login .x-logo {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.btn-twitter-login .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* ===================================
   按钮系统 - Cinematic Buttons
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    min-height: var(--touch-target);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    position: relative;
}

/* Primary CTA - White Pill */
.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Secondary - Outline */
.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* Accent CTA - Coral */
.btn-accent {
    background: var(--accent);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.btn-accent:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 12px 18px;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    padding: 12px 24px;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-default);
}

/* Small Button */
.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
    min-height: 36px;
}

/* Large Button */
.btn-lg {
    padding: 18px 36px;
    font-size: 16px;
    min-height: 56px;
}

/* Extra Large Button */
.btn-large {
    padding: 16px 32px;
    font-size: 15px;
    font-weight: 600;
    min-height: 52px;
}

/* Danger Button */
.btn-danger {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

.btn-danger.btn-sm {
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-danger.btn-sm:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

/* ===================================
   卡片系统 - Cinematic Cards
   =================================== */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-card);
}

.card-elevated {
    background: var(--surface-elevated);
    box-shadow: var(--shadow-md);
}

.card-elevated:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
}

/* ===================================
   标签系统 - Tags
   =================================== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.tag-accent {
    background: rgba(240, 90, 74, 0.1);
    color: var(--accent);
    border-color: rgba(240, 90, 74, 0.2);
}

.tag-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}

/* ===================================
   输入框系统 - Inputs
   =================================== */
.input {
    width: 100%;
    padding: 14px 18px;
    min-height: 48px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition-smooth);
}

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

.input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-focus);
}

textarea.input {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* ===================================
   Toast 提示
   =================================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 14px 28px;
    background: var(--surface-elevated);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    z-index: 10000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    border-color: rgba(34, 197, 94, 0.3);
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
}

/* ===================================
   Modal 弹窗
   =================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

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

.modal {
    background: var(--surface-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(20px);
    transition: all var(--transition-smooth);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.modal-content {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 28px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ===================================
   响应式基础
   =================================== */
@media (max-width: 768px) {
    .auth-container {
        padding: 36px 28px;
    }

    .auth-container h1 {
        font-size: 28px;
    }

    .auth-logo {
        width: 70px;
        height: 70px;
    }

    .theme-toggle {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* ===================================
   滚动条样式
   =================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===================================
   选择高亮
   =================================== */
::selection {
    background: rgba(240, 90, 74, 0.3);
    color: var(--text-primary);
}

/* ===================================
   生成器页面入口
   =================================== */
#generator-page {
    min-height: 100vh;
    min-height: 100dvh;
}
