@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    /* Colors - Light Theme (Default, but can be toggled) */
    --primary-color: #ff2d55;
    --primary-hover: #e00030;
    --primary-light: rgba(255, 45, 85, 0.1);
    --accent-color: #00f3ff;

    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;

    --text-color: #0f172a;
    --text-muted: #64748b;

    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 4px 15px rgba(255, 45, 85, 0.2);

    /* Layout */
    --header-height: 72px;
    --radius: 4px;
    --radius-lg: 8px;

    /* Header */
    --header-bg: rgba(255, 255, 255, 0.9);

    /* Text Glow (Subtle in Light) */
    --text-glow: none;
    --nav-hover: #f1f5f9;
    --sidebar-bg: #ffffff;
    --sidebar-width: 280px;
    --sidebar-active: #fff1f2;
}

[data-theme="dark"] {
    /* Colors - Cyberpunk Red Theme (Dark Mode) */
    --bg-color: #0a0a0a;
    --surface-color: #111111;
    --border-color: #333333;

    --text-color: #e2e2e2;
    --text-muted: #888888;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-glow: 0 0 10px rgba(255, 45, 85, 0.5);

    --header-bg: rgba(10, 10, 10, 0.9);
    --text-glow: 0 0 8px rgba(255, 45, 85, 0.6);
    --nav-hover: #1a1a1a;
    --sidebar-bg: #0a0a0a;
    --sidebar-active: rgba(255, 45, 85, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
}

#browse {
    scroll-margin-top: 120px;
    /* Space for the sticky header */
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

ul {
    list-style: none;
}

/* --- Layout --- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.main-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main-content {
    padding: 2.5rem;
    flex: 1;
    overflow-y: auto;
}

/* --- Grid System --- */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -1rem;
    margin-left: -1rem;
}

.row>[class*="col-"] {
    padding-right: 1rem;
    padding-left: 1rem;
    width: 100%;
}

@media (min-width: 992px) {
    .col-lg-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-lg-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

.public-main {
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    gap: 1rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-color), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

/* Table Style */
.table-container {
    overflow-x: auto;
    background: var(--surface-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1.25rem 1.5rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.025em;
}

tr:last-child td {
    border-bottom: none;
}

.sidebar-nav {
    padding: 1.5rem 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav a i {
    width: 20px;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.sidebar-nav a:hover {
    background-color: var(--nav-hover);
    color: var(--text-color);
    padding-right: 1.5rem;
}

.sidebar-nav a:hover i {
    transform: scale(1.15);
    opacity: 1;
    color: var(--primary-color);
}

.sidebar-nav a.active {
    background-color: var(--sidebar-active);
    color: var(--primary-color);
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.1);
}

.sidebar-nav a.active i {
    opacity: 1;
    color: var(--primary-color);
    transform: scale(1.1);
}

.sidebar-nav a.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 18px;
    width: 4px;
    border-radius: 4px;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 1.25rem;
    opacity: 0.5;
}

.nav-group-title {
    padding: 1.5rem 1.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    opacity: 0.7;
}

/* --- Header --- */
.glass-header {
    height: var(--header-height);
    background-color: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 500;
}

.mobile-bottom-nav,
.menu-toggle,
.mobile-overlay,
.mobile-overlay-backdrop {
    display: none;
}


.header-start {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.page-title-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-color);
    opacity: 0.9;
}

.header-end {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.public-header {
    position: fixed;
    width: 100%;
    top: 0;
    right: 0;
    left: 0;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.65rem;
    color: var(--text-color);
}

.logo span {
    background: linear-gradient(135deg, var(--primary-color), #0ea5e9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Nav */
.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.5rem 0;
    position: relative;
    font-size: 1.05rem;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: none;
    gap: 0.6rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.1rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--surface-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.auth-wrapper {
    min-height: calc(100vh - var(--header-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: radial-gradient(circle at top left, var(--bg-color), var(--surface-color));
}

.auth-card {
    width: 100%;
    max-width: 450px;
    animation: authFadeUp 0.5s ease-out;
}

@keyframes authFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

/* Icon Buttons & Avatars */
header .icon-btn {
    background: var(--surface-color) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    font-size: 1.1rem !important;
    cursor: pointer;
    width: 40px;
    height: 40px;
    aspect-ratio: 1/1;
    border-radius: 50% !important;
    /* Force Circular */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    padding: 0;
    line-height: 1;
}

header .icon-btn:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    transform: rotate(15deg) scale(1.1);
    color: #ffffff !important;
}

header .avatar-circle {
    width: 40px;
    height: 40px;
    aspect-ratio: 1/1;
    border-radius: 50% !important;
    /* Force Circular */
    background: linear-gradient(135deg, var(--primary-color), #0ea5e9) !important;
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--surface-color) !important;
    box-shadow: 0 0 0 1px var(--border-color), var(--shadow-sm);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    text-decoration: none !important;
}

header .avatar-circle:hover {
    transform: scale(1.1);
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

/* Cards */
.card {
    margin: 10px 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

/* Custom Hero for Homepage */
.hero {
    background: var(--hero-bg);
    color: var(--hero-text);
    padding: 12rem 1.5rem 8rem;
    /* Default desktop padding */
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 4rem;
    transition: background 0.4s ease, color 0.4s ease;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://www.transparenttextures.com/patterns/cubes.png');
    opacity: var(--hero-pattern-opacity);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    z-index: 10;
    position: relative;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.hero p {
    font-size: 1.25rem;
    color: var(--hero-muted);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    z-index: 10;
    position: relative;
}

/* Stats */
.stat-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* Desktop optimization */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Responsive */
@media (max-width: 1000px) {
    .container {
        padding: 0 1rem;
        /* Reduced horizontal padding */
    }

    .hero {
        padding: 8rem 1rem 4rem !important;
        /* Significantly reduced top padding for mobile */
    }

    .hero h1 {
        font-size: 2.2rem;
        margin-top: 0;
    }

    .nav-links {
        display: none;
    }

    /* Mobile Bottom Nav */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: var(--header-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--text-muted);
        font-size: 0.7rem;
        font-weight: 600;
        transition: all 0.3s ease;
    }

    .mobile-nav-item i {
        font-size: 1.25rem;
    }

    .mobile-nav-item.active {
        color: var(--primary-color);
    }

    /* Hamburger Menu Button */
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border-radius: 12px;
        background: var(--surface-color);
        border: 1px solid var(--border-color);
        color: var(--text-color);
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1.4rem;
    }

    .menu-toggle:hover {
        background: var(--primary-light);
        color: var(--primary-color);
        transform: scale(1.05);
    }

    /* Mobile Menu Overlay */
    .mobile-overlay {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100%;
        background: var(--surface-color);
        z-index: 2100;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 2rem;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    }

    .mobile-overlay.active {
        right: 0;
    }

    .mobile-overlay-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 2050;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-overlay-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2rem;
    }

    .close-menu-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--bg-color);
        border: 1px solid var(--border-color);
        color: var(--text-color);
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .close-menu-btn:hover {
        background: var(--danger);
        color: white;
        border-color: var(--danger);
        /* transform: rotate(90deg); Removed animation as requested */
    }

    .mobile-menu-links {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .mobile-menu-link {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        border-radius: 12px;
        background: var(--bg-color);
        font-weight: 600;
        color: var(--text-color);
        transition: all 0.2s ease;
        font-size: 1rem;
        /* Ensure consistent size */
        font-family: inherit;
        /* Ensure font matches */
    }

    .mobile-menu-link:hover {
        background: var(--primary-light);
        color: var(--primary-color);
    }

    .mobile-menu-link i {
        width: 24px;
        font-size: 1.2rem;
        color: var(--primary-color);
    }

    /* Hide desktop elements on mobile */
    .desktop-only {
        display: none !important;
    }


    .sidebar {
        position: fixed;
        right: -100%;
        top: 0;
        bottom: 0;
        z-index: 2000;
    }

    .sidebar.sidebar-open {
        right: 0;
        box-shadow: -10px 0 25px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        padding: 1.5rem;
    }
}

/* Switch UI */
.switch input:checked+.slider {
    background-color: var(--primary-color);
}

.switch input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-color);
}

.switch input:checked+.slider:before {
    transform: translateX(24px);
}

.slider.round:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch .slider:after {
    content: 'OFF';
    color: white;
    display: block;
    position: absolute;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 70%;
    font-size: 0.6rem;
    font-weight: 800;
    transition: all 0.4s;
}

.switch input:checked+.slider:after {
    content: 'ON';
    left: 30%;
}

/* ========================================
   ADMIN MOBILE RESPONSIVE STYLES
======================================== */

/* Mobile - Small Tablets (768px and below) */
@media (max-width: 768px) {

    /* Header */
    .top-header {
        padding: 0.8rem 1rem !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-start {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }

    .logo-text {
        font-size: 0.95rem !important;
    }

    .page-title-text {
        font-size: 0.9rem !important;
        display: none;
    }

    .header-end {
        gap: 0.3rem;
    }

    .header-end .icon-btn {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .avatar-circle {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    /* Main Content */
    .main-content {
        padding: 1rem !important;
    }

    /* Cards */
    .card {
        padding: 1rem !important;
        border-radius: 10px;
    }

    .card h1,
    .card h2 {
        font-size: 1.2rem !important;
    }

    .card h3 {
        font-size: 1rem !important;
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.85rem;
        min-width: 600px;
    }

    th,
    td {
        padding: 0.6rem 0.5rem !important;
        white-space: nowrap;
    }

    /* Buttons */
    .btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
    }

    .btn-lg {
        padding: 0.8rem 1.2rem !important;
        font-size: 0.9rem !important;
    }

    .btn-sm {
        padding: 0.4rem 0.7rem !important;
        font-size: 0.75rem !important;
    }

    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-control {
        padding: 0.7rem !important;
        font-size: 0.9rem !important;
    }

    label {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }

    /* Stats Grid */
    .stats-row,
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.8rem !important;
    }

    .stat-card,
    .quick-stat {
        padding: 1rem !important;
    }

    .stat-card h2,
    .stat-card .stat-value {
        font-size: 1.5rem !important;
    }

    /* Alerts */
    .alert {
        padding: 0.8rem 1rem !important;
        font-size: 0.9rem !important;
    }

    /* Badges */
    .badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* Action buttons in tables */
    .action-btns {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }

    .action-btns .btn {
        width: 100%;
    }
}

/* Mobile - Small Phones (480px and below) */
@media (max-width: 480px) {

    .top-header {
        padding: 0.6rem 0.8rem !important;
    }

    .logo-link img {
        height: 28px !important;
    }

    .logo-text {
        display: none !important;
    }

    .main-content {
        padding: 0.8rem !important;
    }

    .card {
        padding: 0.8rem !important;
        margin-bottom: 1rem;
    }

    .stats-row,
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card h2,
    .stat-card .stat-value {
        font-size: 1.3rem !important;
    }

    table {
        font-size: 0.75rem;
    }

    th,
    td {
        padding: 0.5rem 0.4rem !important;
    }

    .btn {
        padding: 0.5rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    h1 {
        font-size: 1.3rem !important;
    }

    h2 {
        font-size: 1.1rem !important;
    }

    h3 {
        font-size: 0.95rem !important;
    }

    /* Hide non-essential columns on very small screens */
    .hide-mobile {
        display: none !important;
    }
}

/* Fix for flexbox gaps on iOS */
@supports (-webkit-touch-callout: none) {

    .header-start,
    .header-end {
        gap: 0.5rem;
    }
}