/* Custom Global Theme Variables Engine */
.theme-dark {
    --bg-base: #070a13;
    --bg-sidebar: #0c101f;
    --glass-bg: rgba(22, 30, 49, 0.65);
    --glass-border: rgba(6, 182, 212, 0.15);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --input-bg: #111827;
}

.theme-light {
    --bg-base: #f1f5f9;
    --bg-sidebar: #ffffff;
    --glass-bg: #ffffff;           
    --glass-border: #cbd5e1;       
    --text-main: #000000;         
    --text-muted: #334155;        
    --input-bg: #f8fafc;
}

/* Base Layout Enforcements */
body {
    background-color: var(--bg-base);
    color: var(--text-main);
    transition: background-color 0.2s ease, color 0.2s ease;
    overflow-x: hidden;
}

.sidebar { 
    background-color: var(--bg-sidebar) !important; 
    border-color: var(--glass-border) !important; 
}

/* Glassmorphism Conditionally Loaded Based on Active Theme State */
.theme-dark .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.theme-light .glass-card {
    background: #ffffff !important; 
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}

/* Strict Global Typography Enforcements */
body, h1, h2, h3, h4, p, span, label, textarea, select, ul, li {
    color: var(--text-main) !important;
}

.text-muted, p.text-muted, p.text-xs, .compliance-hdr, ul li, li {
    color: var(--text-muted) !important;
    font-weight: 500 !important; 
}

.force-cyan, .text-cyan-400, #quality-val, .logo-dot {
    color: #0891b2 !important; 
    font-weight: 700 !important;
}

.dynamic-adsense-label {
    color: #0284c7 !important; 
    font-weight: 600 !important;
}

.side-special {
    color: #0891b2 !important;
    border-color: rgba(6, 182, 212, 0.4) !important;
}

.input-field { 
    background-color: var(--input-bg) !important; 
    color: var(--text-main) !important; 
    border: 1px solid var(--glass-border) !important; 
}

#sidebar-menu button.bg-gradient-to-r {
    color: #ffffff !important; 
    font-weight: 700 !important;
}

/* ==========================================================================
   ⚡ MOBILE OPTIMIZATION ENHANCEMENTS ENGINE (BREAKPOINT: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .flex-col {
        flex-direction: column !important;
    }
    
    /* FIX 2: Fixed border-r syntax error to proper border-right standard */
    aside.sidebar {
        width: 100% !important;
        border-right: 0 !important;
        border-bottom: 1px solid var(--glass-border) !important;
        padding: 12px !important;
        position: sticky;
        top: 70px;
        z-index: 40;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    aside.sidebar h2 {
        display: none !important;
    }

    /* FIX 3: Consolidated double selector ambiguity into structural clean target */
    nav#sidebar-menu {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        gap: 8px !important;
        padding-bottom: 6px !important;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    nav#sidebar-menu::-webkit-scrollbar {
        display: none !important;
    }

    nav#sidebar-menu button {
        display: inline-block !important;
        width: auto !important;
        padding: 6px 14px !important;
        font-size: 11px !important;
        border-radius: 9999px !important; 
        flex-shrink: 0 !important;
    }

    #compliance-menu {
        margin-top: 4px !important;
        border-top: 1px dashed var(--glass-border);
        padding-top: 6px !important;
    }

    /* FIX 1: Removed Tailwind non-standard space-y property and replaced with standard margin layout rules */
    main {
        padding: 16px !important;
    }
    
    main > * {
        margin-bottom: 20px !important;
    }

    .glass-card {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    h2.text-3xl, h2.text-4xl {
        font-size: 20px !important;
        line-height: 1.3 !important;
    }

    h3.text-2xl {
        font-size: 16px !important;
    }

    img, #compress-preview, #convert-preview, #resize-preview, #ocr-preview {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .grid-cols-1.sm:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}