/* ============================================
   EVEREST CONCURSOS - THEME SYSTEM
   Dark/Light Mode with CSS Variables
   ============================================ */

/* ========== THEME VARIABLES ========== */
:root {
    /* Brand Colors (constant) */
    --brand-primary: #FF6600;
    --brand-primary-hover: #ff8533;
    --brand-primary-light: rgba(255, 102, 0, 0.1);
    --brand-primary-medium: rgba(255, 102, 0, 0.2);
    --brand-secondary: #1c3533;
    --brand-accent: #75fb92;
    --brand-success: #22c55e;
    --brand-warning: #f59e0b;
    --brand-error: #ef4444;

    /* Transition */
    --theme-transition: 0.3s ease;
}

/* ========== LIGHT THEME (Default) ========== */
[data-theme="light"],
:root {
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f4f1eb;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --bg-navbar: #ffffff;
    --bg-footer: #1a1a1a;
    --bg-input: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);

    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary: #757b7b;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;
    --text-on-primary: #ffffff;

    /* Borders */
    --border-color: #e4e4e4;
    --border-color-light: #efefef;
    --border-color-dark: #d1d5db;

    /* Shadows */
    --shadow-sm: 0 1px 2px 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);

    /* Component Specific */
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --navbar-border: var(--border-color);
    --card-bg: var(--bg-card);
    --card-border: var(--border-color);
    --input-bg: var(--bg-input);
    --input-border: var(--border-color);
    --input-focus-border: var(--brand-primary);
    --button-secondary-bg: #f3f4f6;
    --button-secondary-hover: #e5e7eb;

    /* Section Backgrounds */
    --section-light: #ffffff;
    --section-alt: #f8f9fa;
    --section-dark: #1a1a1a;

    /* Hero Gradient */
    --hero-gradient: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f4f1eb 100%);

    /* Logo - source artwork is white; force it black in light theme for contrast */
    --logo-filter: brightness(0);
}

/* ========== DARK THEME ========== */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #151515;
    --bg-card-hover: #1f1f1f;
    --bg-navbar: #0a0a0a;
    --bg-footer: #000000;
    --bg-input: #1a1a1a;
    --bg-overlay: rgba(0, 0, 0, 0.8);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --text-tertiary: #a0a0a0;
    --text-muted: #6b7280;
    --text-inverse: #1a1a1a;
    --text-on-primary: #ffffff;

    /* Borders */
    --border-color: #2a2a2a;
    --border-color-light: #1f1f1f;
    --border-color-dark: #3a3a3a;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);

    /* Component Specific */
    --navbar-bg: rgba(10, 10, 10, 0.95);
    --navbar-border: var(--border-color);
    --card-bg: var(--bg-card);
    --card-border: var(--border-color);
    --input-bg: var(--bg-input);
    --input-border: var(--border-color);
    --input-focus-border: var(--brand-primary);
    --button-secondary-bg: #2a2a2a;
    --button-secondary-hover: #3a3a3a;

    /* Section Backgrounds */
    --section-light: #111111;
    --section-alt: #0a0a0a;
    --section-dark: #000000;

    /* Hero Gradient */
    --hero-gradient: linear-gradient(135deg, #0a0a0a 0%, #111111 50%, #0a0a0a 100%);

    /* Logo - source artwork is already white, keep it as-is in dark theme */
    --logo-filter: none;
}

/* ========== THEME SWITCH (shadcn style) ========== */
.theme-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 36px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

[data-theme="dark"] .theme-switch {
    background: rgba(255, 255, 255, 0.1);
}

.theme-switch:hover {
    background: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .theme-switch:hover {
    background: rgba(255, 255, 255, 0.15);
}

.theme-switch:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.theme-switch-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
    transition: all 0.2s ease-out;
}

/* Light mode - sol laranja, lua cinza */
.theme-switch-icon.sun {
    left: 10px;
    color: #FF6600;
    opacity: 1;
    transform: scale(1.1);
}

.theme-switch-icon.moon {
    right: 10px;
    color: #64748b;
    opacity: 0.5;
    transform: scale(1);
}

/* Dark mode - lua laranja, sol cinza */
html[data-theme="dark"] .theme-switch-icon.sun {
    color: #94a3b8;
    opacity: 0.5;
    transform: scale(1);
}

html[data-theme="dark"] .theme-switch-icon.moon {
    color: #FF6600;
    opacity: 1;
    transform: scale(1.1);
}

.theme-switch-thumb {
    position: absolute;
    width: 28px;
    height: 28px;
    background: #ffffff;
    border-radius: 9999px;
    left: 4px;
    z-index: 2;
    transition: left 0.2s ease-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .theme-switch-thumb {
    left: calc(100% - 32px);
    background: #ffffff;
}

/* Manter compatibilidade com classe antiga */
.theme-toggle {
    display: none;
}

/* ========== ALTERNATIVE TOGGLE STYLES ========== */

/* Style 2: Simple Icon Toggle */
.theme-toggle-simple {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--theme-transition);
}

.theme-toggle-simple:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-light);
}

.theme-toggle-simple .icon-sun,
.theme-toggle-simple .icon-moon {
    font-size: 20px;
    transition: all var(--theme-transition);
}

.theme-toggle-simple .icon-sun {
    display: block;
    color: #f59e0b;
}

.theme-toggle-simple .icon-moon {
    display: none;
    color: #6366f1;
}

[data-theme="dark"] .theme-toggle-simple .icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle-simple .icon-moon {
    display: block;
}

/* Style 3: Text Toggle */
.theme-toggle-text {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--theme-transition);
    font-size: 14px;
    color: var(--text-secondary);
}

.theme-toggle-text:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.theme-toggle-text .toggle-label-light,
.theme-toggle-text .toggle-label-dark {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-text .toggle-label-dark {
    display: none;
}

[data-theme="dark"] .theme-toggle-text .toggle-label-light {
    display: none;
}

[data-theme="dark"] .theme-toggle-text .toggle-label-dark {
    display: flex;
}

/* ========== GLOBAL THEME TRANSITIONS ========== */
body,
body *:not(.no-transition) {
    transition:
        background-color var(--theme-transition),
        border-color var(--theme-transition),
        color var(--theme-transition),
        box-shadow var(--theme-transition);
}

/* ========== BASE THEME STYLES ========== */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Navbar */
.navbar,
.w-nav {
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--navbar-border);
    backdrop-filter: blur(10px);
}

/* Sections */
.section {
    background-color: var(--bg-primary);
}

.section.light {
    background-color: var(--section-light);
}

.section.alt,
.section.grey {
    background-color: var(--section-alt);
}

/* Cards */
.course-card,
.teacher-card,
.blog-card,
.step-tile,
.included-card,
.sales-card,
.category-card {
    background-color: var(--card-bg) !important;
    border-color: var(--card-border) !important;
}

.course-card:hover,
.teacher-card:hover,
.blog-card:hover,
.step-tile:hover,
.category-card:hover {
    background-color: var(--bg-card-hover) !important;
}

/* Text */
h1, h2, h3, h4, h5, h6,
.mega-h1 {
    color: var(--text-primary);
}

p, .paragraph, .paragraph-big, .text-medium {
    color: var(--text-secondary);
}

.subtext, .paragraph-small {
    color: var(--text-tertiary);
}

/* Links */
a {
    color: var(--text-primary);
}

a:hover {
    color: var(--brand-primary);
}

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

.link-nav:hover,
.link-nav.w--current {
    color: var(--brand-primary) !important;
}

/* Buttons */
.cta {
    background-color: var(--brand-primary) !important;
    color: var(--text-on-primary) !important;
}

.cta:hover {
    background-color: var(--brand-primary-hover) !important;
}

.cta.secondary {
    background-color: var(--button-secondary-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

.cta.secondary:hover {
    background-color: var(--button-secondary-hover) !important;
    border-color: var(--brand-primary);
}

/* Inputs */
input, textarea, select,
.w-input, .w-select {
    background-color: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
}

input:focus, textarea:focus, select:focus,
.w-input:focus, .w-select:focus {
    border-color: var(--input-focus-border) !important;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Footer */
.footer,
footer {
    background-color: var(--bg-footer) !important;
    color: var(--text-inverse);
}

/* Dividers */
.divider,
.divider-nav,
hr {
    background-color: var(--border-color);
    border-color: var(--border-color);
}

/* Icons */
.step-icon,
.category-icon {
    background-color: var(--brand-primary-light);
}

/* Colored Blocks */
.colored-block {
    background-color: var(--section-alt);
}

/* Hero */
.hero-home,
.hero-sales {
    background: var(--hero-gradient);
}

/* ========== SPECIAL OVERRIDES ========== */

/* Fix for specific Webflow classes */
[data-theme="dark"] .w-nav {
    background-color: var(--navbar-bg) !important;
}

/* Apply logo filter in both themes: black in light, white in dark */
.brand-image-navbar {
    filter: var(--logo-filter);
}

/* Span italic (keep brand color) */
.span-italic {
    color: var(--brand-primary);
}

/* CTA Links */
.cta-link {
    color: var(--brand-primary);
}

.cta-link:hover {
    color: var(--brand-primary-hover);
}

/* Check icons */
.check-list-icon img {
    filter: hue-rotate(0deg) saturate(1);
}

[data-theme="dark"] .check-list-icon img {
    filter: brightness(1.2);
}

/* Review stars */
.review-star,
[class*="star"] {
    color: #f59e0b;
}

/* Social Icons */
.social-icon,
.footer-social a {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.social-icon:hover,
.footer-social a:hover {
    background-color: var(--brand-primary);
    color: var(--text-on-primary);
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 768px) {
    .theme-toggle {
        width: 50px;
        height: 28px;
    }

    .theme-toggle-slider {
        width: 20px;
        height: 20px;
    }

    [data-theme="dark"] .theme-toggle-slider {
        left: calc(100% - 24px);
    }

    .theme-toggle-simple {
        width: 40px;
        height: 40px;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .theme-toggle,
    .theme-toggle-simple,
    .theme-toggle-text {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}
