/* Apex Scholar Core Style Sheet - Modern Dark Theme */

:root {
    --bg-dark: #07080a;               /* Deep obsidian black */
    --bg-dark-card: #12141a;          /* Lustrous carbon black metallic background */
    --bg-darker: #040507;             /* True absolute black gold */
    --border-color: #3b321c;          /* Burnished bronze gold border */
    
    --primary-accent: #d4af37;        /* Luxe Metallic Royal Gold */
    --primary-accent-hover: #f3e5ab;  /* Brilliant satin champagne gold */
    
    --accent-glow: rgba(212, 175, 55, 0.22); /* Warm liquid gold aura glow */
    --secondary-accent: #f2d26d;      /* Warm metallic satin silk gold */
    --warning-accent: #ffa500;        /* Amber Gold */
    --danger-accent: #ff6b6b;         /* Ruby dark red */
}

/* Base resets and defaults */
body {
    background-color: var(--bg-dark) !important;
    color: #e2e8f0 !important;
    font-family: 'Inter', --font-sans, system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography styles */
.font-sans {
    font-family: 'Inter', sans-serif !important;
}

.font-display {
    font-family: 'Space Grotesk', sans-serif !important;
}

.font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Nav & Container tweaks */
.navbar {
    background-color: var(--bg-dark-card) !important;
    border-color: var(--border-color) !important;
}

.bg-dark-card {
    background-color: var(--bg-dark-card) !important;
}

.bg-darker {
    background-color: var(--bg-darker) !important;
}

.text-accent {
    color: var(--primary-accent) !important;
}

.text-accent-secondary {
    color: var(--secondary-accent) !important;
}

.text-warning-accent {
    color: var(--warning-accent) !important;
}

/* Custom cards styling */
.card {
    background: linear-gradient(145deg, #0d0f14, #040507) !important;
    border: 2px solid #d4af37 !important;
    border-bottom: 5px solid #8a6d1c !important;
    border-radius: 16px !important;
    color: #f1f5f9 !important;
    box-shadow: 0 12px 35px rgba(0,0,0,0.8), 
                0 0 15px rgba(212, 175, 55, 0.22),
                inset 0 1px 1px rgba(212, 175, 55, 0.15) !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                border-color 0.25s ease, 
                box-shadow 0.25s ease !important;
}

.card:hover {
    transform: translateY(-6px) scale(1.02) !important;
    border-color: #f3e5ab !important;
    border-bottom: 5px solid #d4af37 !important;
    box-shadow: 0 18px 45px rgba(212, 175, 55, 0.35), 
                0 0 25px rgba(212, 175, 55, 0.3),
                inset 0 1px 2px rgba(255, 255, 255, 0.15) !important;
}

.card-glowing {
    border-color: var(--primary-accent) !important;
    box-shadow: 0 0 20px var(--accent-glow), 
                inset 0 1px 2px rgba(212, 175, 55, 0.2) !important;
}

/* Inputs & Actions */
.form-control, .form-select {
    background: linear-gradient(145deg, #101217, #08090d) !important;
    border: 2px solid #3b321c !important;
    border-bottom: 4px solid #201b0f !important;
    border-radius: 12px !important;
    padding: 10px 16px !important;
    color: #f3e5ab !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6) !important;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.form-control:focus, .form-select:focus {
    border-color: #cca43b !important;
    border-bottom: 4px solid var(--primary-accent) !important;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.25), inset 0 1px 2px rgba(255,255,255,0.05) !important;
    background-color: #0b0d12 !important;
    transform: translateY(-1px) !important;
}

.btn-primary-accent {
    background: linear-gradient(180deg, #d4af37 0%, #8a6d1c 100%) !important;
    color: #040507 !important;
    border: 1px solid #c59f2e !important;
    border-bottom: 4px solid #55410c !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700 !important;
    transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.25) !important;
}

.btn-primary-accent:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #edd27c 0%, #a48222 100%) !important;
    border-bottom: 4px solid #3d2f09 !important;
    box-shadow: 0 8px 16px rgba(212, 175, 55, 0.25);
    color: #040507 !important;
}

.btn-primary-accent:active {
    transform: translateY(3px) !important;
    border-bottom: 1px solid #55410c !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
}

/* Custom premium background gradients with rich metallic gold style */
.bg-gradient-premium {
    background: linear-gradient(135deg, #110d05 0%, #291e0a 50%, #110d05 100%) !important;
    color: var(--primary-accent) !important;
    border: 2px solid #55410c !important;
    border-bottom: 5px solid #2d2306 !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6), inset 0 1px 1px rgba(212, 175, 55, 0.2) !important;
}

.bg-gradient-srs {
    background: linear-gradient(135deg, #1a1710 0%, #55410c 50%, #1a1710 100%) !important;
    border: 1px solid #cca43b !important;
    color: #f3e5ab !important;
}

/* Active practice flashcard styles */
.flashcard-box {
    perspective: 1000px;
    height: 320px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flashcard-box.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.flashcard-front {
    background-color: var(--bg-dark-card);
}

.flashcard-back {
    background-color: #1a2233;
    border-color: var(--primary-accent);
    transform: rotateY(180deg);
}

/* Progress bar, XP pill, levels styling */
.progress-bar-xp {
    background-color: var(--secondary-accent) !important;
    background-image: linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent) !important;
    background-size: 1rem 1rem !important;
    animation: progress-bar-stripes 1s linear infinite;
}

/* Ad specific styles */
.object-cover-ad-banner {
    object-fit: cover !important;
}

.hover-underline:hover {
    text-decoration: underline;
}

.xsmall {
    font-size: 0.75rem !important;
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #343f56;
}

/* Sidebar and Application Layout Structures */
.app-layout {
    min-height: 100vh;
    display: flex;
    position: relative;
    width: 100%;
}

.app-content-wrapper {
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-vh-100;
}

/* Sidebar structure */
.sidebar {
    width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow-x: hidden;
}

/* Sidebar Brand adjustment */
.sidebar-brand-box {
    height: 64px;
    min-height: 64px;
    overflow: hidden;
}
.sidebar-brand-text {
    transition: opacity 0.2s ease, width 0.2s ease;
}

/* Base list navigation inside sidebar */
.sidebar-nav {
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbar for layout purity */
}
.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.sidebar .nav-link {
    color: #94a3b8 !important;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.04) !important;
}

.sidebar .nav-link.active {
    background-color: var(--primary-accent) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(58, 130, 246, 0.25);
}

.sidebar-label {
    transition: opacity 0.25s ease, width 0.25s ease;
    opacity: 1;
    display: inline-block;
}

.sidebar-logout-text {
    transition: opacity 0.25s ease, width 0.25s ease;
}

/* Sidebar Collapsed State (Desktop Toggle) */
.sidebar.sidebar-collapsed {
    width: 72px;
}

.sidebar.sidebar-collapsed .sidebar-label,
.sidebar.sidebar-collapsed .sidebar-brand-text,
.sidebar.sidebar-collapsed .avatar-meta,
.sidebar.sidebar-collapsed .sidebar-logout-text,
.sidebar.sidebar-collapsed .sidebar-category-text {
    opacity: 0 !important;
    width: 0 !important;
    pointer-events: none;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar.sidebar-collapsed .sidebar-brand-box {
    justify-content: center !important;
}
.sidebar.sidebar-collapsed .sidebar-brand-icon {
    margin-right: 0 !important;
}

.sidebar.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding-left: 12px !important;
    padding-right: 12px !important;
}
.sidebar.sidebar-collapsed .sidebar-nav .sidebar-icon {
    margin-right: 0 !important;
    font-size: 1.2rem;
}

.sidebar.sidebar-collapsed .sidebar-footer {
    padding: 12px 8px !important;
}
.sidebar.sidebar-collapsed .user-info-box {
    justify-content: center !important;
}
.sidebar.sidebar-collapsed .avatar {
    margin-right: 0 !important;
}

/* Mobile responsive drawer overlay and structure */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-100%);
        z-index: 1050;
        height: 100vh;
        box-shadow: none;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6) !important;
    }
}

/* Backdrop Overlay styling */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1045;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
    display: block !important;
}

/* Ergononmic Mobile Bottom Menu Navigation Bar */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(22, 26, 34, 0.92) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--border-color) !important;
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.4);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-decoration: none !important;
    font-size: 0.68rem;
    font-family: 'Space Grotesk', sans-serif;
    gap: 2px;
    flex: 1;
    height: 100%;
    transition: color 0.15s ease;
}

.mobile-nav-item i {
    font-size: 1.2rem;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-nav-item:hover, .mobile-nav-item.active {
    color: var(--primary-accent) !important;
}

.mobile-nav-item.active i {
    transform: translateY(-2px) scale(1.08);
}

/* Safe Padding margins for content above bars */
@media (max-width: 767.98px) {
    main {
        padding-bottom: 84px !important;
    }
}
sidebar-toggle-btn {
    transition: background-color 0.15s ease;
}
.sidebar-toggle-btn:hover {
    background-color: var(--border-color) !important;
}

/* HIGH-END PREMIUM HARDWARE 3D DESIGN SYSTEMS */
.shadow-3d {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.65), 
                inset 0 1px 0 rgba(255, 255, 255, 0.08), 
                0 2px 4px rgba(0, 0, 0, 0.3);
}

.card-3d, .card {
    background: linear-gradient(145deg, #0d0f14, #040507) !important;
    border: 2px solid #d4af37 !important;
    border-bottom: 5px solid #8a6d1c !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 35px rgba(0,0,0,0.8), 
                0 0 15px rgba(212, 175, 55, 0.22),
                inset 0 1px 1px rgba(212, 175, 55, 0.15) !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                border-color 0.25s ease, 
                box-shadow 0.25s ease !important;
}

.card:hover, .card-3d:hover {
    transform: translateY(-6px) scale(1.02) !important;
    border-color: #f3e5ab !important;
    border-bottom: 5px solid #d4af37 !important;
    box-shadow: 0 18px 45px rgba(212, 175, 55, 0.35), 
                0 0 25px rgba(212, 175, 55, 0.3),
                inset 0 1px 2px rgba(255, 255, 255, 0.15) !important;
}

/* Interactive Tactile 3D Buttons */
.btn-primary-accent, .btn-primary, .btn-warning, .btn-danger, .btn-success, .btn-outline-light, .btn-3d {
    position: relative;
    transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.25) !important;
}

.btn-primary-accent, .btn-3d {
    background: linear-gradient(180deg, #d4af37 0%, #8a6d1c 100%) !important;
    color: #040507 !important;
    border: 1px solid #c59f2e !important;
    border-bottom: 4px solid #55410c !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700 !important;
}
.btn-primary-accent:hover, .btn-3d:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #edd27c 0%, #a48222 100%) !important;
    border-bottom: 4px solid #3d2f09 !important;
    box-shadow: 0 8px 16px rgba(212, 175, 55, 0.25);
    color: #040507 !important;
}
.btn-primary-accent:active, .btn-3d:active {
    transform: translateY(3px) !important;
    border-bottom: 1px solid #55410c !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
}

/* Secondary 3D btn */
.btn-outline-secondary {
    background: linear-gradient(180deg, #262933 0%, #111319 100%) !important;
    border: 1px solid #3b321c !important;
    border-bottom: 4px solid #1a1710 !important;
    color: #e5c158 !important;
    transition: all 0.15s ease-out;
}
.btn-outline-secondary:hover {
    transform: translateY(-2px);
    border-color: #d4af37 !important;
    color: #fff !important;
    box-shadow: 0 6px 12px rgba(212, 175, 55, 0.1);
}
.btn-outline-secondary:active {
    transform: translateY(3px) !important;
    border-bottom: 1px solid #3b321c !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Success 3D button */
.btn-success {
    background: linear-gradient(180deg, #10b981 0%, #047857 100%) !important;
    border: 1px solid #047857 !important;
    border-bottom: 4px solid #064e3b !important;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
    color: #ffffff !important;
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.25);
    color: #ffffff !important;
}
.btn-success:active {
    transform: translateY(3px) !important;
    border-bottom: 1px solid #064e3b !important;
}

/* Danger 3D button */
.btn-danger {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%) !important;
    border: 1px solid #b91c1c !important;
    border-bottom: 4px solid #7f1d1d !important;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.25);
}
.btn-danger:active {
    transform: translateY(3px) !important;
    border-bottom: 1px solid #7f1d1d !important;
}

/* Premium 3D Flashcard Design */
.flashcard-box {
    perspective: 1500px;
}
.flashcard-front, .flashcard-back {
    border: 3px solid #2d3748 !important;
    border-bottom: 8px solid #1a202c !important;
    border-radius: 20px !important;
    background: linear-gradient(145deg, #1e2533, #0f121d) !important;
    box-shadow: 0 20px 45px rgba(0,0,0,0.5), 
                inset 0 1px 1px rgba(255, 255, 255, 0.12) !important;
}

.flashcard-back {
    border-color: var(--primary-accent) !important;
    border-bottom: 8px solid #1d4ed8 !important;
    background: linear-gradient(145deg, #141c2f, #0b101c) !important;
}

.flashcard-box.flipped .flashcard-inner {
    transform: rotateY(180deg) translateZ(10px);
}

/* Badge/capsule layers */
.user-badge {
    background: linear-gradient(145deg, #1a202c, #0d0f14) !important;
    border: 2px solid #2d3748 !important;
    border-bottom: 3.5px solid #1e2430 !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.05),
                0 4px 8px rgba(0,0,0,0.3);
}

.progress {
    background-color: #0b0d12 !important;
    border: 1px solid #1a202c !important;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.5);
}

/* WIDESCREEN HORIZONTAL NAVIGATION LUXURY OVERRIDES */
@media (min-width: 768px) {
    #app-sidebar {
        display: none !important;
    }
    .app-layout {
        display: block !important;
    }
    .app-content-wrapper {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
        display: block !important;
    }
    #desktop-sidebar-trigger {
        display: none !important;
    }
    .navbar {
        height: auto !important;
        min-height: 72px !important;
        padding: 0.5rem 2rem !important;
    }
}

/* Gold Theme Custom Nav Links */
.nav-gold-link {
    color: #94a3b8 !important;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.nav-gold-link:hover {
    color: #f3e5ab !important;
    background: rgba(212, 175, 55, 0.08) !important;
    border: 1px solid rgba(212, 175, 55, 0.2) !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

.nav-gold-link.active {
    color: #040507 !important;
    background: linear-gradient(135deg, #d4af37 0%, #aa7c11 100%) !important;
    border: 1px solid #d4af37 !important;
    border-bottom: 2.5px solid #5a4510 !important;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.25);
}

/* Premium Header Elements */
.logo-gold {
    background: linear-gradient(135deg, #f3e5ab 0%, #d4af37 50%, #8a6d1c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800 !important;
}

.user-badge-gold {
    background: linear-gradient(145deg, #181b24, #0a0b0f) !important;
    border: 2px solid #55410c !important;
    border-bottom: 4.5px solid #2d2306 !important;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6), inset 0 1px 1px rgba(212, 175, 55, 0.15) !important;
    transition: all 0.2s ease;
}

.user-badge-gold:hover {
    border-color: #cca43b !important;
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.15);
}

.badge-lvl-gold {
    background: linear-gradient(135deg, #d4af37 0%, #8a6d1c 100%) !important;
    color: #040507 !important;
    font-weight: 800 !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem !important;
}

/* Hide scrollbars for modern minimalist look */
.no-scrollbar::-webkit-scrollbar {
    display: none !important;
}
.no-scrollbar {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* Gilded Gamified Tables styling - Dark 3D Design */
.table-gilded {
    --bs-table-bg: transparent !important;
    --bs-table-color: #ffffff !important;
    --bs-table-bg-state: transparent !important;
    background: transparent !important;
    border-collapse: separate !important;
    border-spacing: 0 12px !important; /* space between rows for 3D card deck appearance */
    width: 100%;
}
.table-gilded thead tr {
    background: transparent !important;
}
.table-gilded thead th {
    color: #f3e5ab !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    font-size: 0.85rem;
    font-family: 'Space Grotesk', sans-serif !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 20px !important;
    border: none !important;
    background: transparent !important;
}
.table-gilded tbody tr {
    background: transparent !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
.table-gilded tbody tr:hover {
    transform: translateY(-4px) !important;
}

/* Base table cells - Styled with dark 3D design */
.table-gilded tbody td, .table-gilded tbody th {
    background: linear-gradient(145deg, #101217, #08090d) !important;
    border-top: 2px solid #3b321c !important;
    border-bottom: 5px solid #201b0f !important;
    color: #e2e8f0 !important;
    padding: 16px 20px !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5) !important; /* Force override of Bootstrap's table shadow overlay */
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* Global definitions for deluxe obsidian card containers & gilded text headings */
.card-obsidian {
    background: linear-gradient(180deg, #07090d 0%, #010204 100%) !important;
    border: 2px solid #caa337 !important;
    border-bottom: 5px solid #8e6d1b !important;
    box-shadow: 0 15px 40px rgba(0,0,0,0.9) !important;
    border-radius: 16px !important;
}
.text-gilded {
    color: #f4d375 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

/* Left-most cell rounded corners and 3D border */
.table-gilded tbody td:first-child, .table-gilded tbody th:first-child {
    border-left: 2px solid #3b321c !important;
    border-top-left-radius: 12px !important;
    border-bottom-left-radius: 12px !important;
}

/* Right-most cell rounded corners and 3D border */
.table-gilded tbody td:last-child {
    border-right: 2px solid #3b321c !important;
    border-top-right-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

/* Hover effects for row cells */
.table-gilded tbody tr:hover td, .table-gilded tbody tr:hover th {
    background: linear-gradient(145deg, #1d202b, #0d0f14) !important;
    border-top-color: #cca43b !important;
    border-bottom-color: var(--primary-accent) !important;
    border-bottom-width: 5px !important;
    color: #ffffff !important;
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.15) !important;
}
.table-gilded tbody tr:hover td:first-child, .table-gilded tbody tr:hover th:first-child {
    border-left-color: #cca43b !important;
}
.table-gilded tbody tr:hover td:last-child {
    border-right-color: #cca43b !important;
}

/* Specific glowing highlights for the Logged-in User's active row - No weird whiteboard */
.table-gilded tbody tr.leaderboard-row-me td,
.table-gilded tbody tr.leaderboard-row-me th {
    background: linear-gradient(145deg, #241f10, #131008) !important;
    border-top: 2px solid var(--primary-accent) !important;
    border-bottom: 5.5px solid #8a6d1c !important;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.25) !important;
}
.table-gilded tbody tr.leaderboard-row-me td:first-child,
.table-gilded tbody tr.leaderboard-row-me th:first-child {
    border-left: 2px solid var(--primary-accent) !important;
}
.table-gilded tbody tr.leaderboard-row-me td:last-child {
    border-right: 2px solid var(--primary-accent) !important;
}

/* Hover highlights for active user's row */
.table-gilded tbody tr.leaderboard-row-me:hover td,
.table-gilded tbody tr.leaderboard-row-me:hover th {
    background: linear-gradient(145deg, #302914, #18140a) !important;
    border-top-color: #f3e5ab !important;
    border-bottom-color: #ecc038 !important;
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.45) !important;
}

/* Float-Gold animation */
@keyframes float-gold {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}
.animate-float-gold {
    animation: float-gold 4s ease-in-out infinite;
}

/* Pulsing premium live glow */
@keyframes gold-pulse-glow {
    0% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.2); }
    50% { box-shadow: 0 0 25px rgba(212, 175, 55, 0.55); }
    100% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.2); }
}
.animate-pulse-gold-glow {
    animation: gold-pulse-glow 3s infinite ease-in-out;
}

/* Base Responsive Alignment Stabilizer */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Core Calendar Spaced Planner Grid Module */
.calendar-grid-wrapper {
    width: 100% !important;
    overflow-x: hidden !important; /* completely avoid horizontal overflow */
}
.calendar-header-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    text-align: center;
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
}
.calendar-days-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
}
.calendar-day, .calendar-day-node {
    min-height: 10px !important;
    padding: 6px 8px !important;
    border-radius: 8px !important;
    transition: all 0.2s ease;
}
.calendar-day:hover {
    background-color: rgba(212, 175, 55, 0.08) !important;
}

/* HIGH-END ERGONOMIC MOBILE APP TOUCH OPTIMIZATIONS */
@media (max-width: 767.98px) {
    /* Compress container spacing to look like a tight, sleek native mobile app layout */
    body {
        font-size: 0.88rem !important;
        line-height: 1.4 !important;
    }
    
    .container-fluid, .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    main {
        padding-top: 12px !important;
        padding-bottom: 96px !important; /* Elegant breather space for bottom mobile menu */
    }
    
    /* Make cards extremely elegant, compact and non-obtrusive */
    .card {
        padding: 14px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(212, 175, 55, 0.4) !important;
        border-bottom: 3.5px solid #8a6d1c !important;
        box-shadow: 0 6px 20px rgba(0,0,0,0.6) !important;
        margin-bottom: 12px !important;
    }
    .card:hover {
        transform: none !important; /* Disable hover jumps on touch screens */
        box-shadow: 0 6px 20px rgba(0,0,0,0.6) !important;
    }
    
    /* Dynamic grid systems optimized for mobile density */
    .row {
        --bs-gutter-x: 10px !important;
        --bs-gutter-y: 10px !important;
    }
    
    /* Clean displays and typography spacing */
    h1, .h1 {
        font-size: 1.35rem !important;
        letter-spacing: -0.015em !important;
        margin-bottom: 4px !important;
    }
    h2, .h2 {
        font-size: 1.25rem !important;
        margin-bottom: 4px !important;
    }
    h3, .h3 {
        font-size: 1.15rem !important;
        margin-bottom: 4px !important;
    }
    h4, .h4 {
        font-size: 1.05rem !important;
    }
    
    /* Extremely tactile, beautifully sized action button nodes */
    .btn {
        padding: 8px 16px !important;
        font-size: 0.82rem !important;
        font-weight: 600 !important;
        border-radius: 30px !important; /* Circular premium pills */
        min-height: 38px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
    }
    .btn-sm {
        padding: 6px 12px !important;
        font-size: 0.76rem !important;
        min-height: 32px !important;
    }
    
    /* Premium text fields and selector tags */
    .form-control, .form-select {
        padding: 8px 14px !important;
        font-size: 16px !important;
        border-radius: 10px !important;
        min-height: 38px !important;
    }
    
    /* Mobile-optimized responsive tables */
    .table-responsive {
        border-radius: 12px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .table-responsive::-webkit-scrollbar {
        height: 4px !important;
    }
    
    /* Hide non-critical badges or elements inside lists */
    .d-mobile-none {
        display: none !important;
    }
    
    /* Segmented Navigation adjustments */
    .admin-segmented-nav {
        border-radius: 12px !important;
        padding: 4px !important;
    }
    .admin-tab-btn {
        font-size: 0.75rem !important;
        padding: 6px 10px !important;
        border-radius: 8px !important;
        min-width: 85px !important;
    }

    /* Calendar Spaced Planner Mobile Optimizations */
    .calendar-grid-wrapper .d-grid, .calendar-header-grid, .calendar-days-grid {
        grid-template-columns: repeat(7, 1fr) !important;
        gap: 3px !important;
    }
    .calendar-day, .calendar-day-node {
        min-height: 10px !important;
        padding: 4px 1.5px !important;
        border-radius: 4px !important;
    }
    .calendar-day .badge {
        display: none !important; /* Hide Today badge on tiny screens to avoid breaking layout */
    }
    .calendar-day .d-flex.flex-column.gap-1.mt-1 {
        margin-top: 1px !important;
        gap: 1px !important;
    }
    .calendar-day .d-flex.flex-column.gap-1.mt-1 span {
        font-size: 0.50rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1 !important;
    }
    .calendar-day .d-flex.flex-column.gap-1.mt-1 span i {
        font-size: 0.42rem !important;
        margin-right: 1px !important;
    }

    /* Gilded Tables & Leaderboard Mobile Optimizations */
    .table-gilded {
        border-spacing: 0 4px !important;
    }
    .table-gilded thead th {
        padding: 6px 8px !important;
        font-size: 0.7rem !important;
        letter-spacing: 0.04em !important;
        width: auto !important;
    }
    .table-gilded tbody td, .table-gilded tbody th {
        padding: 6px 8px !important;
        font-size: 0.75rem !important;
        width: auto !important;
    }
    .table-gilded tbody tr:hover td, .table-gilded tbody tr:hover th {
        border-bottom-width: 3px !important;
    }
    .avatar-indicator {
        width: 28px !important;
        height: 28px !important;
        margin-right: 6px !important;
        font-size: 0.8rem !important;
    }
