/* =================================================================
   CALCTOOLS — LIGHT THEME OVERRIDES
   Aplicado quando <html data-theme="light">
   Todos os seletores usam [data-theme="light"] para garantir
   especificidade suficiente sobre o Bootswatch Vapor (dark).
   !important é usado apenas para sobrescrever inline styles
   gerados em templates.js.
   ================================================================= */

/* ── Transição suave ao trocar de tema ─────────────────────────── */
html,
body,
.navbar,
nav.navbar,
.card,
.glass-card,
.glass-card-dark,
.feature-card,
.stat-card,
.value-card,
.category-card,
footer,
.footer,
.dropdown-menu,
.accordion-item,
.accordion-button,
.accordion-body,
.form-control,
.form-select,
.input-group-text,
.alert,
.modal-content {
    transition: background-color 0.25s ease,
                color 0.25s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease;
}

/* ── Bootstrap 5 CSS Variables ─────────────────────────────────── */
[data-theme="light"] {
    /* Body */
    --bs-body-bg:                  #faf5ff;
    --bs-body-color:               #1a1a2e;
    --bs-secondary-color:          rgba(26, 26, 46, 0.65);
    --bs-tertiary-color:           rgba(26, 26, 46, 0.4);
    --bs-emphasis-color:           #000;

    /* Backgrounds */
    --bs-secondary-bg:             #f3e8ff;
    --bs-tertiary-bg:              #ede9fe;

    /* Borders */
    --bs-border-color:             #d4c5f9;
    --bs-border-color-translucent: rgba(111, 66, 193, 0.15);

    /* Cards */
    --bs-card-bg:                  #ffffff;
    --bs-card-color:               #1a1a2e;
    --bs-card-cap-bg:              rgba(111, 66, 193, 0.05);

    /* Dropdowns */
    --bs-dropdown-bg:              #ffffff;
    --bs-dropdown-color:           #1a1a2e;
    --bs-dropdown-border-color:    rgba(111, 66, 193, 0.2);
    --bs-dropdown-link-color:      #1a1a2e;
    --bs-dropdown-link-hover-bg:   rgba(111, 66, 193, 0.08);
    --bs-dropdown-link-hover-color:#6f42c1;
    --bs-dropdown-divider-bg:      rgba(111, 66, 193, 0.1);

    /* Modals */
    --bs-modal-bg:                 #ffffff;
    --bs-modal-color:              #1a1a2e;

    /* Tables */
    --bs-table-bg:                 transparent;
    --bs-table-color:              #1a1a2e;
    --bs-table-striped-bg:         rgba(111, 66, 193, 0.05);
    --bs-table-hover-bg:           rgba(111, 66, 193, 0.08);
    --bs-table-border-color:       #d4c5f9;

    /* Nav */
    --bs-nav-link-color:           #1a1a2e;
    --bs-nav-link-hover-color:     #6f42c1;

    /* Accordion */
    --bs-accordion-bg:             #ffffff;
    --bs-accordion-color:          #1a1a2e;
    --bs-accordion-border-color:   rgba(111, 66, 193, 0.2);
    --bs-accordion-btn-color:      #1a1a2e;
    --bs-accordion-btn-bg:         rgba(111, 66, 193, 0.05);
    --bs-accordion-active-bg:      rgba(111, 66, 193, 0.1);
    --bs-accordion-active-color:   #6f42c1;
    --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231a1a2e'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236f42c1'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");

    /* Custom CalcTools vars */
    --glass-bg:         rgba(255, 255, 255, 0.85);
    --glass-bg-strong:  rgba(255, 255, 255, 0.97);
    --glass-border:     rgba(111, 66, 193, 0.2);
    --gradient-hero:    linear-gradient(135deg, #faf5ff 0%, #f3e8ff 50%, #fdf2f8 100%);
    --shadow-soft:      0 10px 25px rgba(111, 66, 193, 0.12);
    --shadow-medium:    0 15px 35px rgba(111, 66, 193, 0.18);

    color-scheme: light;
}

/* ── Body ───────────────────────────────────────────────────────── */
[data-theme="light"] body {
    background: var(--gradient-hero);
    background-attachment: fixed;
    color: #1a1a2e;
}

/* ── Navbar ─────────────────────────────────────────────────────── */
[data-theme="light"] .navbar,
[data-theme="light"] nav.navbar {
    background: rgba(255, 255, 255, 0.97) !important;
    border-bottom: 1px solid rgba(111, 66, 193, 0.2) !important;
    box-shadow: 0 4px 20px rgba(111, 66, 193, 0.1) !important;
}

[data-theme="light"] .navbar-brand {
    color: #1a1a2e !important;
    text-shadow: none !important;
}

[data-theme="light"] .navbar-nav .nav-link {
    color: #3a3a5a !important;
}

[data-theme="light"] .navbar-nav .nav-link:hover,
[data-theme="light"] .navbar-nav .nav-link.active {
    background: rgba(111, 66, 193, 0.1) !important;
    color: #6f42c1 !important;
    text-shadow: none !important;
}

[data-theme="light"] .navbar-toggler {
    border-color: rgba(111, 66, 193, 0.3) !important;
}

[data-theme="light"] .navbar-toggler-icon {
    filter: brightness(0);
}

/* ── Dropdown ───────────────────────────────────────────────────── */
[data-theme="light"] .dropdown-menu {
    background: rgba(255, 255, 255, 0.97) !important;
    border: 1px solid rgba(111, 66, 193, 0.2) !important;
    box-shadow: 0 10px 30px rgba(111, 66, 193, 0.12) !important;
}

[data-theme="light"] .dropdown-item {
    color: #1a1a2e !important;
}

[data-theme="light"] .dropdown-item:hover {
    background: rgba(111, 66, 193, 0.08) !important;
    color: #6f42c1 !important;
}

[data-theme="light"] .dropdown-item.active {
    background: rgba(111, 66, 193, 0.12) !important;
    color: #6f42c1 !important;
}

[data-theme="light"] .dropdown-divider {
    border-color: rgba(111, 66, 193, 0.15) !important;
}

/* ── Text color overrides ────────────────────────────────────────── */
[data-theme="light"] .text-white {
    color: #1a1a2e !important;
}

[data-theme="light"] .text-white-75 {
    color: #4a4a6a !important;
}

[data-theme="light"] .text-white-50 {
    color: #7a7a9a !important;
}

[data-theme="light"] .text-shadow,
[data-theme="light"] .text-shadow-light {
    text-shadow: none !important;
}

[data-theme="light"] .text-muted {
    color: #6a6a8a !important;
}

/* Preserve gradient text */
[data-theme="light"] .text-gradient {
    background: linear-gradient(135deg, #6f42c1 0%, #c800ec 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Glass & Custom Cards ────────────────────────────────────────── */
[data-theme="light"] .glass-card,
[data-theme="light"] .glass-card-dark {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(111, 66, 193, 0.15) !important;
    color: #1a1a2e !important;
    box-shadow: 0 8px 25px rgba(111, 66, 193, 0.08) !important;
}

[data-theme="light"] .glass-card::before {
    display: none;
}

[data-theme="light"] .feature-card {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(111, 66, 193, 0.12) !important;
    color: #1a1a2e !important;
}

[data-theme="light"] .feature-card:hover {
    box-shadow: 0 15px 40px rgba(111, 66, 193, 0.15) !important;
}

/* Stat card (sobre/index.html inline <style>) */
[data-theme="light"] .stat-card {
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(111, 66, 193, 0.15) !important;
}

/* Value card (sobre/index.html inline <style>) */
[data-theme="light"] .value-card {
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(111, 66, 193, 0.2) !important;
}

[data-theme="light"] .value-card:hover {
    box-shadow: 0 10px 25px rgba(111, 66, 193, 0.15) !important;
}

/* ── Bootstrap Cards ─────────────────────────────────────────────── */
[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(111, 66, 193, 0.15) !important;
    color: #1a1a2e;
}

[data-theme="light"] .card-body,
[data-theme="light"] .card-header,
[data-theme="light"] .card-footer {
    color: #1a1a2e;
}

/* ── Background utility classes ──────────────────────────────────── */
[data-theme="light"] .bg-dark {
    background-color: rgba(237, 233, 254, 0.6) !important;
    color: #1a1a2e !important;
}

[data-theme="light"] .bg-dark.bg-opacity-50 {
    background-color: rgba(237, 233, 254, 0.35) !important;
}

[data-theme="light"] .bg-gradient-dark {
    background: linear-gradient(135deg, #f3e8ff 0%, #fce4ec 100%) !important;
}

[data-theme="light"] .bg-gradient-light {
    background: linear-gradient(135deg, #fce4ec 0%, #f3e8ff 100%) !important;
}

/* ── Hero Section ────────────────────────────────────────────────── */
[data-theme="light"] .hero-section {
    background: var(--gradient-hero) !important;
}

[data-theme="light"] .hero-section .display-3,
[data-theme="light"] .hero-section .lead {
    color: #1a1a2e;
}

[data-theme="light"] .floating-shapes .shape {
    opacity: 0.12;
}

/* ── Section Divider ─────────────────────────────────────────────── */
[data-theme="light"] .section-divider {
    background: linear-gradient(90deg, transparent, rgba(111, 66, 193, 0.25), transparent) !important;
}

/* ── Form Controls ───────────────────────────────────────────────── */
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background-color: #ffffff !important;
    border-color: #d4c5f9 !important;
    color: #1a1a2e !important;
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
    background-color: #ffffff !important;
    border-color: #6f42c1 !important;
    color: #1a1a2e !important;
    box-shadow: 0 0 0 0.25rem rgba(111, 66, 193, 0.15) !important;
}

[data-theme="light"] .form-control::placeholder {
    color: #9a9abc !important;
    opacity: 1;
}

[data-theme="light"] .input-group-text {
    background-color: rgba(111, 66, 193, 0.07) !important;
    border-color: #d4c5f9 !important;
    color: #1a1a2e !important;
}

[data-theme="light"] .form-text,
[data-theme="light"] .form-label {
    color: #4a4a6a !important;
}

[data-theme="light"] .form-check-label {
    color: #4a4a6a !important;
}

/* ── Range input ─────────────────────────────────────────────────── */
[data-theme="light"] .form-range::-webkit-slider-track {
    background-color: rgba(111, 66, 193, 0.15);
}

/* ── Accordion ───────────────────────────────────────────────────── */
[data-theme="light"] .accordion-item {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(111, 66, 193, 0.2) !important;
    color: #1a1a2e !important;
}

[data-theme="light"] .accordion-button {
    background-color: rgba(243, 232, 255, 0.6) !important;
    color: #1a1a2e !important;
}

[data-theme="light"] .accordion-button.collapsed {
    background-color: rgba(250, 245, 255, 0.8) !important;
    color: #1a1a2e !important;
}

[data-theme="light"] .accordion-button:not(.collapsed) {
    background-color: rgba(111, 66, 193, 0.1) !important;
    color: #6f42c1 !important;
    box-shadow: inset 0 -1px 0 rgba(111, 66, 193, 0.15) !important;
}

[data-theme="light"] .accordion-body {
    background-color: rgba(250, 245, 255, 0.6) !important;
    color: #4a4a6a !important;
}

/* ── Tables ──────────────────────────────────────────────────────── */
[data-theme="light"] .table {
    color: #1a1a2e !important;
    border-color: #d4c5f9 !important;
}

[data-theme="light"] .table-dark,
[data-theme="light"] .table-dark > :not(caption) > * > * {
    background-color: rgba(237, 233, 254, 0.4) !important;
    color: #1a1a2e !important;
    border-color: rgba(111, 66, 193, 0.12) !important;
}

[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(111, 66, 193, 0.04) !important;
    color: #1a1a2e !important;
}

/* ── Alerts ──────────────────────────────────────────────────────── */
[data-theme="light"] .alert-info {
    background-color: rgba(111, 66, 193, 0.08) !important;
    border-color: rgba(111, 66, 193, 0.25) !important;
    color: #2d1b6b !important;
}

[data-theme="light"] .alert-success {
    background-color: rgba(50, 251, 226, 0.08) !important;
    border-color: rgba(50, 251, 226, 0.3) !important;
    color: #0d4d45 !important;
}

[data-theme="light"] .alert-warning {
    background-color: rgba(248, 183, 57, 0.1) !important;
    border-color: rgba(248, 183, 57, 0.3) !important;
    color: #6b4a00 !important;
}

[data-theme="light"] .alert-danger {
    background-color: rgba(234, 57, 184, 0.08) !important;
    border-color: rgba(234, 57, 184, 0.2) !important;
    color: #7a1050 !important;
}

[data-theme="light"] .alert-primary {
    background-color: rgba(111, 66, 193, 0.08) !important;
    border-color: rgba(111, 66, 193, 0.25) !important;
    color: #2d1b6b !important;
}

[data-theme="light"] .alert-heading {
    color: inherit !important;
}

[data-theme="light"] .alert strong {
    color: inherit;
}

/* ── Footer ──────────────────────────────────────────────────────── */
[data-theme="light"] footer,
[data-theme="light"] .footer {
    background: rgba(255, 255, 255, 0.97) !important;
    border-top: 2px solid rgba(111, 66, 193, 0.2) !important;
    color: #1a1a2e !important;
}

[data-theme="light"] footer hr,
[data-theme="light"] .footer hr {
    border-color: rgba(111, 66, 193, 0.15) !important;
}

[data-theme="light"] footer p,
[data-theme="light"] .footer p {
    color: #6a6a8a !important;
}

/* ── Breadcrumb ──────────────────────────────────────────────────── */
[data-theme="light"] .breadcrumb,
[data-theme="light"] ol.breadcrumb {
    background: rgba(255, 255, 255, 0.85) !important;
    --bs-breadcrumb-divider-color: #9a9abc;
    --bs-breadcrumb-item-active-color: #6f42c1;
}

[data-theme="light"] .breadcrumb-item a {
    color: #6f42c1 !important;
}

[data-theme="light"] .breadcrumb-item.active {
    color: #6f42c1 !important;
}

[data-theme="light"] .breadcrumb-item + .breadcrumb-item::before {
    color: #9a9abc !important;
}

/* ── Modal ───────────────────────────────────────────────────────── */
[data-theme="light"] .modal-content,
[data-theme="light"] .glass-modal {
    background: rgba(255, 255, 255, 0.97) !important;
    color: #1a1a2e !important;
    border: 1px solid rgba(111, 66, 193, 0.2) !important;
}

[data-theme="light"] .modal-header {
    border-bottom-color: rgba(111, 66, 193, 0.15) !important;
}

[data-theme="light"] .modal-footer {
    border-top-color: rgba(111, 66, 193, 0.15) !important;
}

[data-theme="light"] .modal-title,
[data-theme="light"] .modal-body {
    color: #1a1a2e !important;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
[data-theme="light"] .btn-outline-light {
    color: #3a3a5a !important;
    border-color: #c4b5f5 !important;
}

[data-theme="light"] .btn-outline-light:hover {
    background-color: rgba(111, 66, 193, 0.08) !important;
    color: #6f42c1 !important;
    border-color: #6f42c1 !important;
}

/* ── Theme toggle button ─────────────────────────────────────────── */
[data-theme="light"] #theme-toggle {
    color: #3a3a5a !important;
    border-color: rgba(111, 66, 193, 0.3) !important;
    background: transparent !important;
}

[data-theme="light"] #theme-toggle:hover {
    background: rgba(111, 66, 193, 0.1) !important;
    color: #6f42c1 !important;
    border-color: #6f42c1 !important;
}

/* ── Progress bar ────────────────────────────────────────────────── */
[data-theme="light"] .progress {
    background-color: rgba(111, 66, 193, 0.1) !important;
}

/* ── Category slider (homepage) ──────────────────────────────────── */
[data-theme="light"] .category-slider-wrapper {
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(111, 66, 193, 0.15) !important;
    color: #1a1a2e !important;
}

/* ── Timeline (sobre page) ───────────────────────────────────────── */
[data-theme="light"] .timeline-item {
    color: #4a4a6a;
}

/* ── List groups ─────────────────────────────────────────────────── */
[data-theme="light"] .list-group-item {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(111, 66, 193, 0.15) !important;
    color: #1a1a2e !important;
}

/* ── Badges — keep colored badges, only adjust bg-secondary ─────── */
[data-theme="light"] .badge.bg-secondary {
    background-color: rgba(111, 66, 193, 0.15) !important;
    color: #4a2090 !important;
}

/* ── Code ────────────────────────────────────────────────────────── */
[data-theme="light"] code {
    background: rgba(111, 66, 193, 0.07);
    color: #6f42c1;
    border-radius: 3px;
    padding: 1px 4px;
}

/* ── Scrollbar ───────────────────────────────────────────────────── */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #f3e8ff !important;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(111, 66, 193, 0.25) !important;
}

/* ── Small utility text in result sections ───────────────────────── */
[data-theme="light"] .text-success,
[data-theme="light"] .text-danger,
[data-theme="light"] .text-warning,
[data-theme="light"] .text-info,
[data-theme="light"] .text-primary {
    /* Keep Bootstrap colored text — no override needed */
}

/* ── Headings ────────────────────────────────────────────────────── */
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6 {
    color: #1a1a2e;
}

/* Keep display headings in hero white — they look better over the gradient */
[data-theme="light"] .hero-section h1.display-3,
[data-theme="light"] .hero-section h1.display-4,
[data-theme="light"] .hero-section h1.display-5 {
    color: #1a1a2e;
}

/* ── Separator in hero stat bar ──────────────────────────────────── */
[data-theme="light"] .stat-item .stat-label {
    color: #7a7a9a !important;
}
