/* 
   CUSTOM UI OPTIMIZATIONS
   Extracted from header.php for better caching and performance.
*/

/* Base (Dark Mode Always) */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    width: 100%;
    position: relative;
    background-color: var(--brand-bg-deep);
    color: var(--brand-text-main);
}

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

/* Glassmorphism Utilities - Dark Mode Only */
.glass {
    background: rgba(var(--brand-surface-rgb), 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--brand-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backface-visibility: hidden;
}

.glass-card {
    background: rgba(var(--brand-primary-rgb), 0.12) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(var(--brand-primary-rgb), 0.2) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.stat-card {
    background: rgba(var(--brand-primary-rgb), 0.08) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(var(--brand-primary-rgb), 0.15) !important;
    position: relative !important;
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.stat-card:hover {
    background: rgba(var(--brand-surface-rgb), 0.65) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.3) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 20px 40px -20px rgba(var(--brand-primary-rgb), 0.25) !important;
}

.rounded-none {
    box-shadow: none !important;
    border-radius: 0 !important;
    transform: none !important;
}

/* --- Global Gray-to-White Transform --- */
[class*="text-gray-"],
[class*="text-slate-"],
[class*="text-zinc-"],
[class*="text-emerald-"],
[class*="text-green-"],
[class*="text-teal-"] {
    color: rgba(255, 255, 255, 0.7) !important;
}

.text-gray-100, .text-slate-100, .text-zinc-100, .text-emerald-100, .text-green-100 {
    color: rgba(255, 255, 255, 0.95) !important;
}

.text-gray-200, .text-slate-200, .text-zinc-200, .text-emerald-200, .text-green-200 {
    color: rgba(255, 255, 255, 0.9) !important;
}

.text-gray-300, .text-slate-300, .text-zinc-300, .text-emerald-300, .text-green-300, .text-emerald-400, .text-green-400 {
    color: rgba(255, 255, 255, 0.85) !important;
}

.text-gray-500, .text-slate-500, .text-zinc-500, .text-emerald-500, .text-green-500 {
    color: rgba(255, 255, 255, 0.6) !important;
}

.text-gray-600, .text-slate-600, .text-zinc-600, .text-emerald-600, .text-green-600 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.text-brand-primary {
    color: #ffffff !important;
}

.text-glow {
    text-shadow: 0 0 20px rgba(var(--brand-primary-rgb), 0.5);
}

/* Animated Background */
.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    overflow: hidden;
}

.g-blob {
    position: absolute;
    background: radial-gradient(circle, rgba(var(--brand-primary-rgb), 0.1) 0%, rgba(var(--brand-primary-rgb), 0.02) 40%, transparent 70%);
    border-radius: 50%;
    animation: move 40s infinite alternate;
    opacity: 1;
    will-change: transform;
    pointer-events: none;
    transform: translateZ(0);
}

.dark .g-blob {
    background: radial-gradient(circle, rgba(var(--brand-primary-rgb), 0.15) 0%, rgba(var(--brand-primary-rgb), 0.05) 40%, transparent 70%);
}

.g-blob:nth-child(1) {
    width: 1000px;
    height: 1000px;
    top: -300px;
    left: -200px;
    background: radial-gradient(circle, rgba(var(--brand-primary-rgb), 0.4) 0%, rgba(0, 0, 0, 0) 75%);
}

.g-blob:nth-child(2) {
    width: 800px;
    height: 800px;
    bottom: -200px;
    right: -100px;
    background: radial-gradient(circle, rgba(var(--brand-accent-rgb), 0.35) 0%, rgba(0, 0, 0, 0) 75%);
    animation-duration: 30s;
}

.g-blob:nth-child(3) {
    width: 700px;
    height: 700px;
    top: 25%;
    right: 15%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, rgba(0, 0, 0, 0) 75%);
    animation-duration: 40s;
}

.g-blob:nth-child(4) {
    width: 600px;
    height: 600px;
    bottom: 20%;
    left: 20%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(0, 0, 0, 0) 75%);
    animation-duration: 35s;
}

@keyframes move {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(30px, 30px, 0) scale(1.05); }
}

/* Admin Form Controls */
.setting-input {
    width: 100%;
    background-color: rgba(2, 44, 34, 0.4) !important;
    border: 1px solid rgba(16, 185, 129, 0.1) !important;
    border-radius: 1rem !important;
    padding: 0.85rem 1.25rem !important;
    color: white !important;
    font-size: 0.95rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05) !important;
}

.setting-input:focus {
    outline: none !important;
    border-color: #10b981 !important;
    background-color: rgba(2, 44, 34, 0.7) !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15), inset 0 2px 4px 0 rgba(0, 0, 0, 0.05) !important;
    transform: translateY(-1px);
}

.setting-input::placeholder { color: rgba(148, 163, 184, 0.3) !important; }

.setting-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(var(--brand-bg-deep-rgb, 1, 13, 10), 0.1); }
::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-primary-rgb), 0.2);
    border-radius: 20px;
    transition: all 0.3s;
}
::-webkit-scrollbar-thumb:hover { background: var(--brand-primary); }

.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-primary-rgb), 0.15);
    border-radius: 20px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(var(--brand-primary-rgb), 0.4); }

.sidebar-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--brand-primary-rgb), 0.2) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-primary-rgb), 0.2);
    border-radius: 20px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(var(--brand-primary-rgb), 0.4); }

@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin-slow { animation: spin-slow 12s linear infinite; }

@keyframes bounce-subtle {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -5px); }
}
.animate-bounce-subtle { animation: bounce-subtle 2s ease-in-out infinite; }

/* GLOBAL CONTRAST & CLARITY SYSTEM */
table td { color: #f1f5f9 !important; }
table th { color: #94a3b8 !important; font-weight: 700; }

.stat-card .text-2xl, .stat-card .text-3xl, .stat-card .text-4xl,
.stat-card [class*="font-bold"], .stat-card [class*="font-semibold"] {
    color: #ffffff !important;
}

.glass-card h2, .glass-card h3, .glass-card .font-bold, .glass-card .font-semibold {
    color: #f8fafc !important;
}

.text-emerald-300 { color: #d1fae5 !important; }
.text-emerald-400 { color: #a7f3d0 !important; }
.glass-card p, .stat-card p { color: #cbd5e1 !important; }

.text-gray-500 { color: #cbd5e1 !important; }
.text-gray-400 { color: #e2e8f0 !important; }
.text-gray-300 { color: #f1f5f9 !important; }
.text-slate-500 { color: #cbd5e1 !important; }
.text-slate-400 { color: #e2e8f0 !important; }
.text-slate-300 { color: #f1f5f9 !important; }

.text-gray-400\/50, .text-gray-500\/50, .text-slate-400\/50, .text-slate-500\/50 {
    color: rgba(226, 232, 240, 0.7) !important;
}

p.text-sm, p.text-xs, span.text-sm, span.text-xs, td span {
    color: #e2e8f0;
}
