/* =================================================================
   Eye Care Pro Website Styles
   Designed for perfect color adaptation by the extension itself
   ================================================================= */

:root {
    /* Primary Colors - Use semantic names for easy theming */
    --primary: #667eea;
    --primary-glow: rgba(102, 126, 234, 0.4);

    /* Background Colors - Will be modified when theme is active */
    --bg-page: #ffffff;
    --bg-dark: #0a0e14;
    --bg-card: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);

    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;

    /* Card Styles */
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

    /* Theme Overlay Colors */
    --theme-warm: #F6F2E3;
    --theme-green: #E8F5E9;
    --theme-focus: #F2F2F2;
    --theme-night: #1a1a1a;

    /* Transition */
    --transition-smooth: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 700;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #4facfe;
}

/* Glass Effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

/* =================================================================
   Navigation
   ================================================================= */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background var(--transition-smooth);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px;
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #4facfe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Header Logo: Black by default */
#header-logo {
    color: #000000;
    background: none;
    -webkit-text-fill-color: initial;
    transition: color var(--transition-smooth);
}

/* Standalone Night Mode: Header Logo turns white */
body.theme-night #header-logo {
    color: #ffffff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.nav-btn {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    color: var(--text-secondary);
    min-width: 50px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 13px;
}

.nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Extension Detection Badge */
.extension-badge {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: badge-appear 0.4s ease-out;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

@keyframes badge-appear {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

body.theme-night .extension-badge {
    background: linear-gradient(135deg, #059669, #047857);
}

/* =================================================================
   Hero Section
   ================================================================= */
.hero {
    padding: 7rem 2rem 3rem;
    /* 减少 padding */
    min-height: auto;
    /* 不强制占满整屏 */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-bg-effects {
    position: fixed;
    /* 改为 fixed 覆盖全页 */
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.6;
    animation: blob-float 25s infinite alternate;
}

.blob-1 {
    top: 10%;
    right: 20%;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.blob-2 {
    bottom: 20%;
    left: 10%;
    background: radial-gradient(circle, #4facfe 0%, transparent 70%);
    animation-delay: -7s;
}

.blob-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, #a8edea 0%, transparent 70%);
    animation-delay: -14s;
}

@keyframes blob-float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(50px, -30px) scale(1.1);
    }

    100% {
        transform: translate(-30px, 50px) scale(0.95);
    }
}

.hero-container {
    max-width: 900px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

/* =================================================================
   Capsules - Core Visual
   ================================================================= */
.capsules-showcase {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.capsule-wrapper {
    text-align: center;
    position: relative;
    cursor: pointer;
    padding-bottom: 60px;
    /* 更多空间给文字，避免拉升后遮挡 */
}

.capsule-wrapper:hover .capsule:not(.selected) {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Tooltip removed by user request */
/* .capsule-wrapper::after { ... } */

.capsule {
    width: 80px;
    height: 130px;
    border-radius: 40px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.capsule.selected {
    transform: scale(1.05) scaleY(1.12) !important;
    /* 轻微拉升，保持圆角 */
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 28px var(--primary-glow);
}

.capsule-top,
.capsule-bottom {
    width: 100%;
    height: 50%;
}

.capsule-name {
    display: block;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s;
    white-space: nowrap;
}

.capsule-wrapper:hover .capsule-name {
    color: var(--text-primary);
}

/* =================================================================
   Hero CTA Button
   ================================================================= */
.hero-cta {
    margin-top: 2rem;
}

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--primary-glow);
    color: white;
}

/* =================================================================
   Features Section
   ================================================================= */
.features {
    padding: 2rem 2rem 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.features-header {
    text-align: center;
    margin-bottom: 3rem;
}

.features-header h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 900px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    padding: 2rem;
    border-radius: 20px;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: var(--primary);
}

.feature-icon svg {
    width: 100%;
    height: 100%;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* =================================================================
   CTA Section
   ================================================================= */
.cta {
    text-align: center;
    padding: 6rem 2rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(79, 172, 254, 0.05) 100%);
    border-radius: 0;
}

.cta h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.cta-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* =================================================================
   Footer
   ================================================================= */
footer {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    line-height: 1.4;
}

footer p {
    margin-bottom: 0.4rem;
    opacity: 0.8;
}

footer p:last-child {
    margin-bottom: 0;
}

footer a {
    color: var(--primary);
    font-weight: 500;
}

footer a:hover {
    color: #4facfe;
}

#footer-logo {
    font-size: 0.85rem;
    display: inline;
}

#footer-beian {
    margin-top: 0.6rem;
}

#footer-beian a {
    color: inherit;
    margin: 0 0.4rem;
    font-weight: normal;
}

#footer-beian a:hover {
    color: var(--primary);
}

/* =================================================================
   Animations
   ================================================================= */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s forwards ease-out;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================================================
   Theme Active States - Page Background Changes
   ================================================================= */
body.theme-warm {
    --bg-page: #F6F2E3;
    --bg-card: #FFFDF8;
    --glass-bg: rgba(246, 242, 227, 0.85);
}

body.theme-green {
    --bg-page: #E8F5E9;
    --bg-card: #F5FFF5;
    --glass-bg: rgba(232, 245, 233, 0.85);
}

body.theme-focus {
    --bg-page: #F2F2F2;
    --bg-card: #FAFAFA;
    --glass-bg: rgba(242, 242, 242, 0.85);
}

body.theme-night {
    --bg-page: #1a1a1a;
    --bg-card: #252525;
    --bg-dark: #0a0a0a;
    --glass-bg: rgba(30, 30, 30, 0.9);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
}

body.theme-night .navbar {
    background: rgba(26, 26, 26, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.theme-night .nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

body.theme-night .capsule {
    border-color: rgba(255, 255, 255, 0.15);
}

body.theme-night .capsule.selected {
    border-color: rgba(255, 255, 255, 0.9);
}

/* 胶囊颜色由 JavaScript 动态处理 */

body.theme-night .feature-card {
    border-color: rgba(255, 255, 255, 0.08);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

body.theme-night .feature-card:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.08), 0 0 40px rgba(102, 126, 234, 0.1);
}

body.theme-night footer {
    border-top-color: rgba(255, 255, 255, 0.05);
}

body.theme-night .blob {
    opacity: 0.2;
}

/* =================================================================
   Responsive
   ================================================================= */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .capsules-showcase {
        gap: 1.2rem;
    }

    .capsule {
        width: 50px;
        height: 80px;
    }

    .features-header h2,
    .cta h2 {
        font-size: 2rem;
    }

    .btn {
        padding: 0.9rem 2rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.8rem 1rem;
    }

    .hero {
        padding: 8rem 1.5rem 4rem;
    }

    .capsule {
        width: 45px;
        height: 70px;
        border-radius: 22px;
    }

    .capsule-name {
        font-size: 11px;
    }
}

/* =================================================================
   Dark Reader Optimization
   Pre-invert capsules so they look normal after DarkReader inverts them again.
   ================================================================= */
body.dark-optimized {
    background-color: #ffffff;
    /* Ensure white base for DarkReader to invert */
    color: #000000;
}

body.dark-optimized .capsule {
    filter: invert(1) hue-rotate(180deg);
}

/* Ensure the selected state glow is also handled nicely */
body.dark-optimized .capsule.selected {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    /* Inverted glow */
}