/* ═══════════════════════════════════════
   🌟 WebMind - Enhanced UI Styles
   Modern · Clean · Immersive
   ═══════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --success: #10b981;
    --bg: #f0f2f5;
    --bg-gradient: linear-gradient(135deg, #f0f2f5 0%, #e8ecf1 100%);
    --card-bg: rgba(255,255,255,0.95);
    --card-border: rgba(255,255,255,0.3);
    --text-main: #1e293b;
    --text-sub: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    background: var(--bg-gradient);
    margin: 0;
    padding: 0;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Top Navigation ── */
.navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid rgba(226,232,240,0.6);
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}
.logo i { font-size: 22px; }
.logo span { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
    color: var(--text-sub);
    padding: 8px 16px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}
.nav-links a:hover { color: var(--primary); background: rgba(99,102,241,0.08); }
.btn-login {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white !important;
    padding: 8px 22px !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--primary-glow) !important;
    background: linear-gradient(135deg, var(--primary-light), var(--primary)) !important;
}
.lang-switch {
    margin-left: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px 14px !important;
    font-size: 12px !important;
    font-weight: 600;
    color: var(--text-sub) !important;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}
.lang-switch:hover {
    border-color: var(--primary);
    color: var(--primary) !important;
    background: rgba(99,102,241,0.06) !important;
}
.user-profile { display: none; align-items: center; gap: 10px; margin-left: 20px; cursor: pointer; }
.user-avatar { width: 32px; height: 32px; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #64748b; }

/* ── Main Layout ── */
.main-container {
    max-width: 1240px;
    margin: 28px auto;
    padding: 0 20px;
    display: flex;
    gap: 24px;
    flex-direction: column;
}
@media (min-width: 820px) {
    .main-container { flex-direction: row; align-items: flex-start; }
}

/* ── Card ── */
.input-card, .output-card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease;
}
.input-card:hover, .output-card:hover { box-shadow: var(--shadow-lg); }

.input-card {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* ── Mode Tabs ── */
.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}
.mode-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-sub);
    background: #f1f4f9;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    user-select: none;
    white-space: nowrap;
    border: 2px solid transparent;
}
.mode-tab:hover {
    background: #e8ecf5;
    color: var(--primary);
}
.mode-tab i { font-size: 14px; flex-shrink: 0; }
.free-badge {
    font-size: 9px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.4;
    flex-shrink: 0;
    margin-left: 2px;
}
.mode-tab.active {
    background: white;
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(102,126,234,0.15);
    z-index: 1;
}
@media (max-width: 480px) {
    .mode-tabs { grid-template-columns: repeat(2, 1fr); }
    .mode-tab { font-size: 12px; padding: 9px 6px; }
}
.mode-desc {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 16px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #eef2ff, #f0f9ff);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    line-height: 1.5;
}

/* ── Input ── */
#prompt_text {
    width: 100%;
    height: 240px;
    padding: 16px;
    font-size: 15px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    line-height: 1.6;
    background: #fafbfc;
}
#prompt_text:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: white;
}
#prompt_text::placeholder { color: var(--text-light); }

.controls-area {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

/* ── Upload Button ── */
.upload-wrapper { position: relative; overflow: hidden; display: inline-block; }
.btn-upload {
    border: 1.5px dashed #cbd5e1;
    color: var(--text-sub);
    background: #f8fafc;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s;
}
.btn-upload:hover { border-color: var(--primary-light); color: var(--primary); background: #eef2ff; }
#uploaderInput { position: absolute; font-size: 100px; right: 0; top: 0; opacity: 0; cursor: pointer; }

.checkbox-wrapper { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--text-main); cursor: pointer; }

/* ── Submit Button ── */
#submit_btn {
    width: 100%;
    margin-top: 18px;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}
#submit_btn::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}
#submit_btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 8px 28px var(--primary-glow); }
#submit_btn:not(:disabled):hover::before { opacity: 1; }
#submit_btn:not(:disabled):active { transform: translateY(0); }
#submit_btn:disabled { opacity: 0.6; cursor: not-allowed; background: #94a3b8; }

/* ── Output Area ── */
.output-card {
    flex: 1.5;
    padding: 24px;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    overflow: hidden;
}
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.output-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.output-title::before {
    content: '';
    display: inline-block;
    width: 3px; height: 18px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 2px;
}
.action-buttons { display: flex; gap: 8px; }
.action-btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-sub);
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    font-weight: 500;
}
.action-btn:hover { border-color: var(--primary-light); color: var(--primary); background: #f8faff; }

.gpt-content {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 16px;
    max-height: 180px;
    overflow-y: auto;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--success);
    line-height: 1.7;
}

.gpt-mind {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #fafbfc, #f1f4f9);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    min-height: 340px;
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    transition: border-color 0.3s;
}
.gpt-mind:has(img[src]) { border-style: solid; border-color: #e2e8f0; }
.gpt-mind img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    cursor: zoom-in;
    transition: transform 0.3s ease, opacity 0.4s ease;
    opacity: 0;
    animation: fadeInImage 0.5s ease forwards;
}
.gpt-mind img:hover { transform: scale(1.015); }
@keyframes fadeInImage { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── AI Infographic/Drawing Controls ── */
.info-controls {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding: 14px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.info-controls .info-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.info-controls .info-row label { font-size: 13px; font-weight: 600; color: var(--text-main); min-width: 50px; }
.info-controls select {
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    flex: 1;
    min-width: 90px;
    transition: border-color 0.2s;
}
.info-controls select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-glow); }

.btn-examples {
    padding: 6px 14px;
    background: white;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s;
}
.btn-examples:hover { border-color: var(--primary); color: var(--primary); background: #f8faff; }

/* ── Gallery ── */
.gallery-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 4px;
    width: 100%;
}
.gallery-view img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.gallery-view img:hover { transform: scale(1.03); box-shadow: 0 4px 20px rgba(0,0,0,0.1); }

/* ── Examples Panel ── */
.examples-panel {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1500;
    justify-content: center;
    align-items: center;
}
.examples-panel.active { display: flex; }
.examples-box {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.2);
}
.examples-box h3 {
    margin-top: 0;
    font-size: 16px;
    color: var(--text-main);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.example-item {
    padding: 14px;
    margin: 10px 0;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}
.example-item:hover { background: #eef2ff; border-color: var(--primary-light); transform: translateX(2px); }
.example-item .ex-title { font-weight: 600; color: var(--primary); font-size: 14px; margin-bottom: 4px; }
.example-item .ex-prompt { font-size: 12px; color: var(--text-light); line-height: 1.4; }

/* ── Progress Bar ── */
.progress-container { margin: 16px 0; width: 100%; }
.progress-bar { width: 100%; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.4s ease; }
.progress-text { font-size: 12px; color: var(--text-sub); text-align: right; margin-top: 4px; }

/* ── Footer ── */
.footer { text-align: center; padding: 30px 0; color: var(--text-sub); font-size: 13px; border-top: 1px solid var(--border); margin-top: 40px; }
.footer a { color: var(--primary); text-decoration: none; margin: 0 5px; }
.footer a:hover { text-decoration: underline; }

/* ── Login Modal ── */
.overlay-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 1000; justify-content: center; align-items: center; }
.popup-box { background: white; border-radius: var(--radius-lg); width: 90%; max-width: 380px; text-align: center; box-shadow: 0 24px 80px rgba(0,0,0,0.2); overflow: hidden; animation: popupFadeIn 0.3s ease-out; }
@keyframes popupFadeIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.popup-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.popup-title { font-weight: 700; font-size: 16px; color: var(--text-main); margin: 0; }
.close-btn { font-size: 22px; cursor: pointer; color: var(--text-light); transition: color 0.2s; line-height: 1; padding: 0 4px; }
.close-btn:hover { color: var(--text-main); }
.popup-content { padding: 28px 30px; }
.qrcode-container { width: 200px; height: 200px; margin: 0 auto 20px; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: white; }
.popup-image { width: 100%; height: 100%; object-fit: contain; }
.popup-tips { color: var(--text-sub); font-size: 14px; }
.popup-tips i { color: #07c160; margin-right: 5px; }

/* ── Loading Spinner ── */
.spinner { width: 40px; height: 40px; border: 3px solid #e2e8f0; border-top: 3px solid var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 15px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Storybook Voice ── */
.sb-voice-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    user-select: none;
}
.sb-voice-btn:hover { border-color: var(--primary-light); background: #f5f3ff; }
.sb-voice-btn .sb-voice-name { font-weight: 600; color: var(--text-main); }
.sb-voice-btn .sb-voice-desc { color: var(--text-light); font-size: 11px; }
.sb-voice-btn .sb-voice-play {
    padding: 2px 8px; border-radius: 6px;
    background: var(--primary); color: white;
    font-size: 11px; cursor: pointer;
    transition: all 0.2s;
}
.sb-voice-btn .sb-voice-play:hover { background: var(--primary-dark); }

/* ── Image Viewer ── */
.image-viewer { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 2000; justify-content: center; align-items: center; overflow: hidden; }
.image-viewer img { max-width: none; cursor: grab; }
.viewer-controls { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; background: rgba(255,255,255,0.15); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 10px 18px; border-radius: 30px; }
.viewer-btn { background: rgba(255,255,255,0.9); border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #1e293b; transition: all 0.2s; }
.viewer-btn:hover { background: white; transform: scale(1.08); }

/* ── Aspect Ratio ── */
.ratio-wrapper { align-items: center; background: #f8fafc; padding: 4px 10px; border: 1.5px dashed #cbd5e1; border-radius: var(--radius-sm); transition: all 0.25s; display: flex; }
.ratio-wrapper:hover { border-color: var(--primary-light); }
.ratio-select { border: none; outline: none; background: transparent; font-size: 13px; color: var(--text-main); cursor: pointer; font-family: inherit; font-weight: 500; padding: 4px 4px 4px 0; }

/* ====== Global Increments ====== */
html { scroll-behavior: smooth; }
#mind-container { min-height: 300px; display: flex; align-items: center; justify-content: center; }
#popup { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }

/* Examples Panel Animation */
.examples-panel { animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ── SEO Hero Section ── */
.seo-hero {
    text-align: center;
    padding: 48px 32px 32px;
    max-width: 900px;
    margin: 0 auto;
}
.seo-hero h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0 0 12px;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.seo-hero-desc {
    font-size: 16px;
    color: var(--text-sub);
    line-height: 1.7;
    max-width: 720px;
    margin: 0 auto 28px;
}
@media (max-width: 640px) {
    .seo-hero { padding: 32px 16px 20px; }
    .seo-hero h1 { font-size: 24px; }
    .seo-hero-desc { font-size: 14px; }
}
