/* Explain: Base reset, typography, and global element styling. - */
* {
    box-sizing: border-box;
}

html {
    background: var(--background-color);
    scroll-behavior: smooth;
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

html,
body,
header,
section,
footer,
.card-premium,
.glass-panel,
.zone-search-panel,
.input-premium,
.btn-premium,
.btn-accent,
.btn-outline-premium,
.btn-ai,
.btn-whatsapp {
    transition:
        background-color 0.35s ease,
        background 0.35s ease,
        border-color 0.35s ease,
        color 0.25s ease,
        box-shadow 0.35s ease;
}

body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--page-gradient);
    pointer-events: none;
}

/* Soften background decorative elements globally for a refined slate aesthetic */
[class*="blur-"] {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

[class*="blur-[100px]"] {
    opacity: 0.06 !important;
}

html[data-theme="light"] [class*="blur-[100px]"] {
    opacity: 0.08 !important;
}

svg.absolute.pointer-events-none {
    opacity: 0.06 !important;
}

svg[class*="opacity-[0.25]"],
svg[class*="opacity-[0.35]"] {
    opacity: 0.1 !important;
}

html[data-theme="light"] svg[class*="opacity-[0.25]"],
html[data-theme="light"] svg[class*="opacity-[0.35]"] {
    opacity: 0.08 !important;
}

/* Light theme readability layer for existing Tailwind utility-heavy markup */
html[data-theme="light"] .text-white {
    color: var(--text-color) !important;
}

html[data-theme="light"] .text-\[var\(--text-muted\)\] {
    color: var(--text-muted) !important;
}

html[data-theme="light"] .text-\[var\(--text-color\)\] {
    color: var(--text-color) !important;
}

html[data-theme="light"] .bg-\[var\(--background-color\)\] {
    background-color: var(--background-color) !important;
}

html[data-theme="light"] .bg-\[var\(--surface-color\)\] {
    background-color: var(--surface-color) !important;
}

html[data-theme="light"] .border-\[var\(--border-color\)\] {
    border-color: var(--border-color) !important;
}

html[data-theme="light"] [class*="bg-[#101014]"],
html[data-theme="light"] [class*="bg-[#0f172a]"],
html[data-theme="light"] [class*="bg-[#1e293b]"] {
    background-color: var(--dropdown-surface) !important;
}

html[data-theme="light"] [class*="border-white/10"] {
    border-color: var(--border-color) !important;
}

html[data-theme="light"] .btn-premium,
html[data-theme="light"] .btn-accent,
html[data-theme="light"] .btn-whatsapp,
html[data-theme="light"] .floating-whatsapp {
    color: #ffffff !important;
}

html[data-theme="light"] .btn-outline-premium {
    color: var(--text-color) !important;
}

html[data-theme="light"] .btn-ai,
html[data-theme="light"] .btn-ai span,
html[data-theme="light"] .btn-ai i {
    color: var(--text-color) !important;
}

html[data-theme="light"] .btn-ai:hover,
html[data-theme="light"] .btn-ai:hover span,
html[data-theme="light"] .btn-ai:hover i {
    color: #ffffff !important;
}

html[data-theme="light"] .text-green-500,
html[data-theme="light"] .text-green-400 {
    color: #15803d !important;
}

html[data-theme="light"] .text-yellow-500,
html[data-theme="light"] .text-yellow-400,
html[data-theme="light"] .text-yellow-400\/80,
html[data-theme="light"] .text-yellow-400\/90 {
    color: #854d0e !important;
}

html[data-theme="light"] .bg-yellow-500\/10 {
    background-color: rgba(234, 179, 8, 0.15) !important;
    border-color: rgba(234, 179, 8, 0.3) !important;
}

html[data-theme="light"] .text-red-500,
html[data-theme="light"] .text-red-400 {
    color: #b91c1c !important;
}

html[data-theme="light"] .text-sky-400,
html[data-theme="light"] .text-sky-500 {
    color: #0369a1 !important;
}

/* Logo treatment: remove the light-mode frame and tint the logo for daylight contrast */
html[data-theme="light"] header img[alt*="GRIT VISA"],
html[data-theme="light"] footer img[alt*="GRIT VISA"] {
    filter: invert(1) hue-rotate(180deg) saturate(1.1) contrast(1.05);
}

/* Custom Select Styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
}

html[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235f6b7a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

/* Base rich text styles */
.prose {
    color: var(--text-muted);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    color: var(--text-color);
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.prose p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.prose ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

html[data-theme="light"] .prose,
html[data-theme="light"] .prose-invert {
    color: var(--text-muted);
}

html[data-theme="light"] .prose h1,
html[data-theme="light"] .prose h2,
html[data-theme="light"] .prose h3,
html[data-theme="light"] .prose h4,
html[data-theme="light"] .prose-invert h1,
html[data-theme="light"] .prose-invert h2,
html[data-theme="light"] .prose-invert h3,
html[data-theme="light"] .prose-invert h4,
html[data-theme="light"] .prose strong,
html[data-theme="light"] .prose-invert strong {
    color: var(--text-color);
}

html[data-theme="light"] .prose a,
html[data-theme="light"] .prose-invert a {
    color: var(--accent-color);
}

/* Trust and application screens */
html[data-theme="light"] .zone-search-panel .bg-green-500\/5,
html[data-theme="light"] .zone-search-panel .bg-green-500\/10 {
    background-color: rgba(22, 163, 74, 0.08) !important;
}

html[data-theme="light"] .zone-search-panel .bg-yellow-500\/10 {
    background-color: rgba(234, 179, 8, 0.12) !important;
}

html[data-theme="light"] .zone-search-panel .bg-red-500\/10 {
    background-color: rgba(239, 68, 68, 0.09) !important;
}

html[data-theme="light"] .shadow-2xl {
    box-shadow: var(--shadow-panel) !important;
}

html[data-theme="light"] .shadow-lg {
    box-shadow: var(--shadow-card) !important;
}

html[data-theme="light"] .custom-scrollbar {
    scrollbar-color: rgba(2, 119, 189, 0.4) rgba(15, 23, 42, 0.08);
}

/* Mobile light-theme refinement: keep the daylight mode crisp, not brown or washed out */
@media (max-width: 767px) {
    html[data-theme="light"] body::before {
        background: linear-gradient(180deg, #f8fafc 0%, #ffffff 46%, #eef6ff 100%);
    }

    html[data-theme="light"] header {
        background: rgba(255, 255, 255, 0.97) !important;
        border-color: rgba(15, 23, 42, 0.16) !important;
        box-shadow: 0 10px 30px -24px rgba(15, 23, 42, 0.45);
    }

    html[data-theme="light"] .card-premium,
    html[data-theme="light"] .rounded-2xl.border,
    html[data-theme="light"] .rounded-xl.border {
        background-color: rgba(255, 255, 255, 0.96) !important;
        border-color: rgba(15, 23, 42, 0.16) !important;
    }

    html[data-theme="light"] .input-premium,
    html[data-theme="light"] .option-premium,
    html[data-theme="light"] .radio-premium {
        background-color: #ffffff !important;
        color: #0f172a !important;
        border-color: rgba(15, 23, 42, 0.2) !important;
    }

    html[data-theme="light"] .input-premium::placeholder {
        color: #64748b !important;
        opacity: 1;
    }

    html[data-theme="light"] .btn-outline-premium {
        background-color: #ffffff !important;
        border-color: rgba(15, 23, 42, 0.22) !important;
        color: #0f172a !important;
    }

    html[data-theme="light"] .btn-outline-premium:hover {
        border-color: var(--accent-color) !important;
        color: var(--accent-color) !important;
    }

    html[data-theme="light"] .text-white {
        color: #0f172a !important;
    }

    html[data-theme="light"] .text-\[var\(--text-muted\)\] {
        color: #334155 !important;
    }

    html[data-theme="light"] footer .text-white,
    html[data-theme="light"] .btn-premium,
    html[data-theme="light"] .btn-accent,
    html[data-theme="light"] .floating-whatsapp,
    html[data-theme="light"] .btn-whatsapp {
        color: #ffffff !important;
    }
}

[x-cloak] {
    display: none !important;
}