/* ===== CSS VARIABLES - THEME SYSTEM ===== */
:root {
    /* Dark Theme (Default) */
    --bg-primary: #0A0E27;
    --bg-secondary: #111827;
    --bg-tertiary: #1F2937;
    --bg-card: #1a1f3a;
    --bg-hover: rgba(16, 191, 255, 0.05);
    
    --text-primary: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-tertiary: #9CA3AF;
    --text-muted: #6B7280;
    
    --accent-primary: #10BFFF;
    --primary-black: #000000;
    
    --border-color: #374151;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    
    --header-height: 80px; /* Fixed header height variable */
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #F9FAFB;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F3F4F6;
    --bg-card: #FFFFFF;
    --bg-hover: rgba(16, 191, 255, 0.08);
    
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #6B7280;
    --text-muted: #9CA3AF;
    
    --accent-primary: #0EA5E9;
    --primary-black: #FFFFFF;
    
    --border-color: #E5E7EB;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #0EA5E9;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

/* ===== DASHBOARD WRAPPER ===== */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
    transition: background 0.3s ease;
    position: relative;
    overflow: hidden; /* Fix horizontal scroll */
}

/* ===== SIDEBAR ===== */
.dashboard-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0; /* Use bottom: 0 instead of height */
    height: 100%; /* Fallback */
    height: 100dvh; /* Modern fix for mobile address bars */
    z-index: 1002;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sidebar-logo:hover {
    color: var(--accent-primary);
}

.sidebar-logo i {
    color: var(--accent-primary);
}

.sidebar-close {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
}

.sidebar-nav {
    flex: 1; /* Pushes footer to bottom */
    padding: 1.5rem 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    transition: transform 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-item .badge {
    margin-left: auto;
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    font-weight: 700;
}

.badge-primary { background: rgba(16, 191, 255, 0.2); color: var(--accent-primary); border-radius: var(--radius-full); }
.badge-success { background: rgba(34, 197, 94, 0.2); color: #22C55E; border-radius: var(--radius-full); }
.badge-warning { background: rgba(251, 191, 36, 0.2); color: #FBBF24; border-radius: var(--radius-full); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #EF4444; border-radius: var(--radius-full); }

.sidebar-footer {
    padding: 1rem; /* Slightly smaller padding for mobile */
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0; /* Prevents it from shrinking */
    z-index: 10;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-profile:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-black);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0; /* Ensures truncation works */
}

.user-name, .user-email {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-name { font-weight: 600; color: var(--text-primary); font-size: 0.875rem; }
.user-email { font-size: 0.75rem; color: var(--text-tertiary); }

.user-menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
}

.user-dropdown-menu {
    margin-top: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown-menu a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== MAIN CONTENT ===== */
.dashboard-main {
    flex: 1;
    margin-left: 280px; /* Space for sidebar */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - 280px); /* Prevent overflow */
}

.dashboard-content {
    padding: 2rem;
    flex: 1;
    overflow-x: hidden; /* Fix table overflow */
}

/* ===== PAGE HEADER (FIXED) ===== */
.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 39, 0.95);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

[data-theme="light"] .page-header {
    background: rgba(249, 250, 251, 0.95);
}

.page-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.page-header-content h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-header-content p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Menu Toggle (Header) */
.mobile-menu-toggle {
    display: none; /* Hidden by default */
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Floating Menu Button (Bottom Right) */
.mobile-menu-floating {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999; /* High z-index */
    background: var(--accent-primary);
    color: var(--primary-black);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 191, 255, 0.4);
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.mobile-menu-floating:active {
    transform: scale(0.9);
}

/* ===== HEADER ACTIONS ===== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}


/* Target all direct children of header-actions */
.header-actions > * {
    height: 42px !important; /* Force same height */
    min-height: 42px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Specific fix for the Create Escrow button */
.header-actions .btn-primary {
    padding: 0 1rem !important; /* Adjust horizontal padding */
}

/* ON MOBILE: Ensure uniformity */
@media (max-width: 768px) {
    .header-actions > * {
        width: 42px !important; /* Make them squares on mobile */
        padding: 0 !important;
    }
    
    /* Hide text on mobile for Create Escrow */
    .header-actions .btn-primary span {
        display: none !important;
    }
    
    .header-actions .btn-primary i {
        margin: 0 !important;
    }
}


.theme-toggle, .header-action-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}

.theme-toggle:hover, .header-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.theme-icon { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }
[data-theme="light"] .theme-icon-light { display: block; }

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--bg-primary);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    height: 40px; /* Match icon buttons */
    white-space: nowrap;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    height: 32px;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--primary-black);
}

.btn-primary:hover {
    background: #0EA5E9;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(16, 191, 255, 0.1); color: var(--accent-primary); }
.stat-icon.green { background: rgba(34, 197, 94, 0.1); color: #22C55E; }
.stat-icon.yellow { background: rgba(251, 191, 36, 0.1); color: #FBBF24; }
.stat-icon.red { background: rgba(239, 68, 68, 0.1); color: #EF4444; }

.stat-trend {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.stat-trend.up { color: #22C55E; }
.stat-trend.down { color: #EF4444; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ===== TABLES (FIXED) ===== */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    width: 100%;
}

.table-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    width: 200px;
    height: 32px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.table-wrapper {
    overflow-x: auto; /* Enable horizontal scroll */
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ensure table doesn't squish too much */
}

.data-table th {
    background: var(--bg-tertiary);
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.data-table tr:hover {
    background: var(--bg-hover);
}

.transaction-id {
    font-family: monospace;
    color: var(--accent-primary);
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.pending { background: rgba(251, 191, 36, 0.1); color: #FBBF24; }
.status-badge.active { background: rgba(16, 191, 255, 0.1); color: var(--accent-primary); }
.status-badge.completed { background: rgba(34, 197, 94, 0.1); color: #22C55E; }
.status-badge.disputed { background: rgba(239, 68, 68, 0.1); color: #EF4444; }

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
}

/* ===== MOBILE CARD VIEW ===== */
.transaction-cards {
    display: none; /* Hidden on desktop */
    padding: 1rem;
    gap: 1rem;
}

.transaction-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
}

.transaction-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.transaction-card-body {
    display: grid;
    gap: 0.5rem;
}

.transaction-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.transaction-card-label {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.transaction-card-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card { height: 120px; }
.skeleton-row { height: 60px; margin-bottom: 0.5rem; }

/* =========================================
   RESPONSIVE BREAKPOINTS (CRITICAL FIXES)
   ========================================= */

@media (max-width: 1024px) {
    /* Hide Sidebar by Default */
    .dashboard-sidebar {
        transform: translateX(-100%);
    }
    
    /* Show Sidebar when active */
    .dashboard-sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
    }
    
    /* Show Close Button in Sidebar */
    .sidebar-close {
        display: block;
    }
    
    /* Expand Main Content */
    .dashboard-main {
        margin-left: 0;
        width: 100%;
    }
    
    /* Show Mobile Menu Toggle in Header */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Show Floating Menu Button */
    .mobile-menu-floating {
        display: flex;
    }
    
    /* Adjust Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Adjust Header Padding */
    .page-header {
        padding: 0.75rem 1rem;
    }
    
    /* Header Content */
    .page-header-inner {
        gap: 0.5rem;
    }
    
    /* Hide Description on Mobile */
    .page-header-content p {
        display: none;
    }
    
    .page-header-content h1 {
        font-size: 1.125rem;
    }
    
    /* Content Padding */
    .dashboard-content {
        padding: 1rem;
    }
    
    /* Stats Stack Vertically */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Compact Header Buttons */
    .header-actions {
        gap: 0.5rem;
    }
    
    .header-action-btn, .theme-toggle, .mobile-menu-toggle {
        width: 36px;
        height: 36px;
    }
    
    /* Hide New Escrow Text on Mobile */
    .btn-primary.btn-sm span {
        display: none;
    }
    .btn-primary.btn-sm {
        width: 36px;
        padding: 0;
    }
    .btn-primary.btn-sm i {
        margin: 0;
    }
    
    /* Switch Table to Cards */
    .table-wrapper {
        display: none;
    }
    
    .transaction-cards {
        display: flex;
        flex-direction: column;
    }
    
    /* Table Header Adjustments */
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .table-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-input-wrapper {
        flex: 1;
    }
    
    .search-input {
        width: 100%;
    }
    
    /* Hide unnecessary buttons on mobile table header */
    .table-actions .btn-secondary {
        display: none;
    }
}

@media (max-width: 480px) {
    .mobile-menu-floating {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
}

/* ===== PREVENT ZOOM ON MOBILE INPUTS ===== */
@media screen and (max-width: 768px) {
    input, 
    select, 
    textarea, 
    .form-input, 
    .search-input {
        font-size: 16px !important; /* 16px prevents iOS zoom */
    }
}




/* ===== FIXED LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;  /* Force full viewport width */
    height: 100vh; /* Force full viewport height */
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999; /* Ensure it stays on top of everything */
}

/* Container for Icon and Ring */
.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

/* The Icon (Pulse Effect) */
.loading-spinner i {
    color: var(--accent-primary);
    font-size: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

/* The Rotating Ring */
.spinner-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid transparent; /* Transparent background circle */
    border-top-color: var(--accent-primary); /* The colored part */
    border-left-color: var(--accent-primary); /* Add extra color for visibility */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Loading Text */
.loading-screen p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: fadeInOut 2s ease-in-out infinite;
}

/* ===== ANIMATIONS ===== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.85); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}


/* ===== NOTIFICATION HEADER FIX ===== */
@media (max-width: 480px) {
    /* Stack the top controls vertically */
    .notification-header-controls {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }

    /* Make buttons full width or grid */
    .notification-actions {
        display: grid;
        grid-template-columns: 1fr auto; /* Mark Read takes more space, Clear takes less */
        gap: 0.5rem;
        width: 100%;
    }

    /* Adjust button text size slightly */
    .notification-actions .btn {
        padding: 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
        justify-content: center;
    }
    
    /* Make the dropdown full width */
    #filterDropdown, #filterDropdown button {
        width: 100%;
    }
}