/* ==========================================================================
   Richard Gateway - Ultra-Premium Dual Theme Glassmorphism Architecture
   Supports: Cyber Obsidian Glass (Dark) & Neo-Prism Glass (Light)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Light Theme Variables (Neo-Prism Glass)
   -------------------------------------------------------------------------- */
:root,
[data-bs-theme="light"] {
    --ag-brand-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    --ag-primary: #6366f1;
    --ag-primary-rgb: 99, 102, 241;
    --ag-primary-dark: #4f46e5;
    --ag-accent: #06b6d4;

    --ag-body-bg: #f8fafc;
    --ag-text-primary: #0f172a;
    --ag-text-muted: #64748b;

    --ag-glass-bg: rgba(255, 255, 255, 0.82);
    --ag-glass-bg-hover: rgba(255, 255, 255, 0.95);
    --ag-glass-border: rgba(255, 255, 255, 0.9);
    --ag-glass-border-subtle: rgba(226, 232, 240, 0.8);
    --ag-glass-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.04), 0 4px 12px -2px rgba(0, 0, 0, 0.02);
    --ag-glass-shadow-lg: 0 20px 40px -10px rgba(99, 102, 241, 0.12), 0 8px 20px -4px rgba(0, 0, 0, 0.04);
    --ag-glass-blur: blur(20px);

    --ag-nav-bg: rgba(255, 255, 255, 0.85);
    --ag-sidebar-bg: rgba(255, 255, 255, 0.88);
    --ag-sidebar-border: rgba(226, 232, 240, 0.85);

    --ag-table-th: rgba(241, 245, 249, 0.85);
    --ag-table-hover: rgba(248, 250, 252, 0.9);
    --ag-input-bg: rgba(255, 255, 255, 0.9);
    --ag-input-border: rgba(203, 213, 225, 0.8);
}

/* --------------------------------------------------------------------------
   2. Dark Theme Variables (Cyber Obsidian Glass)
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"] {
    --ag-brand-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    --ag-primary: #818cf8;
    --ag-primary-rgb: 129, 140, 248;
    --ag-primary-dark: #6366f1;
    --ag-accent: #22d3ee;

    --ag-body-bg: #070a12;
    --ag-text-primary: #f8fafc;
    --ag-text-muted: #94a3b8;

    --ag-glass-bg: rgba(15, 23, 42, 0.72);
    --ag-glass-bg-hover: rgba(26, 36, 56, 0.85);
    --ag-glass-border: rgba(255, 255, 255, 0.08);
    --ag-glass-border-subtle: rgba(255, 255, 255, 0.05);
    --ag-glass-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    --ag-glass-shadow-lg: 0 24px 50px -10px rgba(99, 102, 241, 0.22), 0 0 20px rgba(99, 102, 241, 0.12);
    --ag-glass-blur: blur(24px);

    --ag-nav-bg: rgba(11, 17, 33, 0.82);
    --ag-sidebar-bg: rgba(11, 17, 33, 0.88);
    --ag-sidebar-border: rgba(255, 255, 255, 0.08);

    --ag-table-th: rgba(30, 41, 59, 0.75);
    --ag-table-hover: rgba(30, 41, 59, 0.45);
    --ag-input-bg: rgba(15, 23, 42, 0.85);
    --ag-input-border: rgba(255, 255, 255, 0.14);
}

/* --------------------------------------------------------------------------
   3. Base Global Styling
   -------------------------------------------------------------------------- */
body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: var(--ag-text-primary);
    background-color: var(--ag-body-bg);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.35s ease, color 0.35s ease;
}

/* --------------------------------------------------------------------------
   4. Ambient Aurora Glow Background (No ugly 9router grid!)
   -------------------------------------------------------------------------- */
.aurora-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Light Theme Aurora */
[data-bs-theme="light"] .aurora-background {
    background: 
        radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(236, 72, 153, 0.1) 0%, transparent 35%),
        radial-gradient(circle at 50% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 80% 75%, rgba(139, 92, 246, 0.08) 0%, transparent 35%),
        #f8fafc;
}

/* Dark Theme Cosmic Luminescence */
[data-bs-theme="dark"] .aurora-background {
    background: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 90% 15%, rgba(168, 85, 247, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 85%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(236, 72, 153, 0.1) 0%, transparent 40%),
        #070a12;
}

.aurora-grid {
    display: none; /* Replaced the repetitive 9router dot grid completely */
}

/* --------------------------------------------------------------------------
   5. Super Glass Cards
   -------------------------------------------------------------------------- */
.glass-card {
    background: var(--ag-glass-bg);
    backdrop-filter: var(--ag-glass-blur);
    -webkit-backdrop-filter: var(--ag-glass-blur);
    border: 1px solid var(--ag-glass-border);
    border-radius: 1.25rem;
    box-shadow: var(--ag-glass-shadow);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.glass-card:hover {
    background: var(--ag-glass-bg-hover);
    box-shadow: var(--ag-glass-shadow-lg);
    border-color: rgba(99, 102, 241, 0.35);
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   6. Navigation Bars & Sidebars
   -------------------------------------------------------------------------- */
.glass-nav {
    background: var(--ag-nav-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--ag-sidebar-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.glass-sidebar {
    background: var(--ag-sidebar-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--ag-sidebar-border);
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    width: 270px;
    z-index: 1030;
}

.glass-sidebar.sidebar-collapsed {
    width: 82px;
}

.glass-sidebar.sidebar-collapsed .sidebar-label,
.glass-sidebar.sidebar-collapsed .sidebar-badge,
.glass-sidebar.sidebar-collapsed .sidebar-footer-info {
    display: none !important;
}

.glass-sidebar.sidebar-collapsed .nav-link {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

.glass-sidebar .nav-link {
    color: var(--ag-text-muted);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.75rem 1rem;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: all 0.25s ease;
}

.glass-sidebar .nav-link:hover {
    color: var(--ag-primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(3px);
}

.glass-sidebar .nav-link.active {
    color: #ffffff;
    background: var(--ag-brand-gradient);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn-glass {
    background: var(--ag-glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--ag-glass-border);
    color: var(--ag-text-primary);
    font-weight: 600;
    transition: all 0.25s ease;
    border-radius: 0.75rem;
}

.btn-glass:hover {
    background: var(--ag-glass-bg-hover);
    color: var(--ag-primary);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.btn-glass-primary {
    background: var(--ag-brand-gradient);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.35);
    border-radius: 0.75rem;
    transition: all 0.25s ease;
}

.btn-glass-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    color: #ffffff !important;
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   8. Form Inputs & Switches
   -------------------------------------------------------------------------- */
.form-control.glass-card,
.form-select.glass-card,
.form-control,
.form-select {
    background: var(--ag-input-bg) !important;
    border: 1px solid var(--ag-input-border) !important;
    color: var(--ag-text-primary) !important;
    border-radius: 0.75rem;
    transition: all 0.25s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ag-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25) !important;
}

.form-switch .form-check-input {
    width: 2.85rem;
    height: 1.5rem;
    cursor: pointer;
    border-radius: 2rem;
    background-color: rgba(148, 163, 184, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.4);
    transition: all 0.25s ease;
}

.form-switch .form-check-input:checked {
    background-color: var(--ag-primary);
    border-color: var(--ag-primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.45);
}

/* --------------------------------------------------------------------------
   9. Tables
   -------------------------------------------------------------------------- */
.table-glass {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table-glass th {
    background: var(--ag-table-th) !important;
    color: var(--ag-text-muted) !important;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--ag-glass-border-subtle) !important;
}

.table-glass td {
    padding: 1.05rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--ag-glass-border-subtle) !important;
    font-size: 0.85rem;
    color: var(--ag-text-primary) !important;
}

.table-glass tbody tr:hover td {
    background: var(--ag-table-hover) !important;
}

/* --------------------------------------------------------------------------
   10. Dark Mode Overrides for Crisp Contrasts
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"] .text-dark {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: rgba(30, 41, 59, 0.7) !important;
    color: #f1f5f9 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: rgba(15, 23, 42, 0.85) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

[data-bs-theme="dark"] .border {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .border-top {
    border-top-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .modal-content {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85) !important;
}

[data-bs-theme="light"] .modal-content {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15) !important;
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* --------------------------------------------------------------------------
   11. Colorful Icon Rings
   -------------------------------------------------------------------------- */
.icon-ring {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    position: relative;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.icon-ring-orange {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(234, 88, 12, 0.3) 100%);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.35);
}

.icon-ring-purple {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(147, 51, 234, 0.3) 100%);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.icon-ring-emerald {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.3) 100%);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.icon-ring-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.3) 100%);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.icon-ring-rose {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.2) 0%, rgba(225, 29, 72, 0.3) 100%);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.35);
}

/* --------------------------------------------------------------------------
   12. Pulse Animation & Utility Badges
   -------------------------------------------------------------------------- */
@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

.pulse-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    animation: pulseDot 2s infinite ease-in-out;
}

.progress-glass {
    height: 0.65rem;
    border-radius: 1rem;
    background-color: rgba(148, 163, 184, 0.2);
    overflow: hidden;
}

.progress-glass .progress-bar {
    border-radius: 1rem;
    transition: width 0.6s ease;
}

pre.code-glass {
    background: rgba(10, 15, 29, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 1rem;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    padding: 1.25rem;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* --------------------------------------------------------------------------
   13. Global Responsive Hardening & Mobile Layout
   -------------------------------------------------------------------------- */
#mainContentWrapper {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

main {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 991.98px) {
    #mainSidebar {
        transform: translateX(-100%);
        transition: transform 0.35s ease;
        z-index: 1080;
    }
    #mainSidebar.show-mobile {
        transform: translateX(0);
    }
    #mainContentWrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
    }
}

