:root {
    --primary-teal: #00838F;
    /* Lighter, more vibrant teal */
    --primary-gradient: linear-gradient(135deg, #00838F 0%, #006064 100%);
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --accent-orange: #FF8F00;
    --danger-red: #d32f2f;
    --success-green: #2e7d32;
    --warning-yellow: #f57c00;
    --text-dark: #202124;
    --text-light: #5f6368;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-dark);
    min-height: 100vh;
}

.admin-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.admin-sidebar {
    width: 280px;
    background: var(--primary-gradient);
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-header p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

.nav-link.logout {
    margin-top: auto;
    color: #ffcdd2;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.nav-link.logout:hover {
    background: rgba(211, 47, 47, 0.8);
    color: white;
    border-color: transparent;
}

/* ===== MAIN CONTENT ===== */
.admin-main {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
    background: transparent;
}

.admin-section {
    display: none;
    animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-section.active {
    display: block;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary-teal);
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Search Input */
.search-input {
    padding: 0.85rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.95rem;
    width: 320px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 4px rgba(0, 131, 143, 0.15);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 3rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== TABLES ===== */
.users-table-container,
.admins-table-container {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.admins-table-container {
    padding: 2rem;
    margin-top: 2rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: rgba(0, 0, 0, 0.02);
}

.users-table th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.users-table tbody tr:last-child {
    border-bottom: none;
}

.users-table tbody tr:hover {
    background: rgba(0, 96, 100, 0.03);
}

.users-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    vertical-align: middle;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}

.status-active {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.status-banned {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.status-blocked {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
}

.admin-role-badge {
    display: inline-flex;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.role-super-admin {
    background: #e3f2fd;
    color: #0277bd;
    border: 1px solid #bbdefb;
}

.role-admin {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}


/* ===== BUTTONS ===== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(0, 131, 143, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-red);
    color: white;
}

.btn-danger:hover {
    background: #b71c1c;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning-yellow);
    color: white;
}

.btn-warning:hover {
    background: #ef6c00;
    box-shadow: 0 4px 12px rgba(239, 108, 0, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-green);
    color: white;
}

.btn-success:hover {
    background: #1b5e20;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.4);
    transform: translateY(-1px);
}

.btn-info {
    background-color: #00bcd4;
    color: white;
}

.btn-info:hover {
    background-color: #0097a7;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.4);
    transform: translateY(-1px);
}

/* ===== TOASTALERTS ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: white;
    color: var(--text-dark);
    min-width: 320px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-left: 5px solid transparent;
    pointer-events: auto;
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-success {
    border-left-color: var(--success-green);
}

.toast-error {
    border-left-color: var(--danger-red);
}

.toast-warning {
    border-left-color: var(--warning-yellow);
}

.toast-info {
    border-left-color: var(--primary-teal);
}

.toast-icon {
    font-size: 1.2rem;
}

/* Remove old status message */
.status-message {
    display: none;
}


/* ===== SKELETON LOADING ===== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
    display: block;
}

.skeleton-box {
    height: 1.2em;
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}


/* ===== SETTINGS ===== */
.settings-group,
.admin-form-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    max-width: 600px;
}

.settings-group h3,
.admin-form-card h3 {
    color: var(--primary-teal);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    border-bottom: 2px solid rgba(0, 96, 100, 0.1);
    padding-bottom: 0.75rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: #f9f9f9;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-teal);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 131, 143, 0.1);
}

/* ===== LOGIN PAGE ===== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    min-height: 100vh;
    background: url('https://images.unsplash.com/photo-1436491865332-7a61a109cc05?q=80&w=2074&auto=format&fit=crop') no-repeat center center/cover;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}

/* Overlay to darken background for better text readability */
.login-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: -1;
}

.login-container {
    background: rgba(255, 255, 255, 0.85);
    /* More transparency */
    padding: 3.5rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 440px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: translateY(0);
    animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #006064 0%, #0097a7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.login-header p {
    color: #5f6368;
    font-size: 1rem;
    font-weight: 500;
}

.login-form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.login-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #455a64;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.login-form-group input:focus {
    outline: none;
    background: white;
    border-color: var(--primary-teal);
    box-shadow: 0 4px 15px rgba(0, 131, 143, 0.15);
    transform: translateY(-1px);
}

.login-btn {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, #00838F 0%, #006064 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 20px -5px rgba(0, 96, 100, 0.4);
    position: relative;
    overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(0, 96, 100, 0.5);
    background: linear-gradient(135deg, #0097a7 0%, #00838F 100%);
}

.login-btn:active {
    transform: scale(0.98);
}

.info-text {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(224, 242, 241, 0.5);
    /* More transparent */
    border-radius: 12px;
    font-size: 0.85rem;
    color: #00695c;
    border: 1px solid rgba(178, 223, 219, 0.5);
    text-align: center;
    line-height: 1.5;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Spinner for Loading */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-teal);
    animation: spin 0.8s linear infinite;
}

#admin-splash .spinner {
    width: 60px;
    height: 60px;
    border-width: 5px;
    border-top-color: var(--primary-teal);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    z-index: 1000;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: 0.3s;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .admin-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        width: 280px;
    }

    .admin-sidebar.active {
        left: 0;
    }

    .admin-main {
        padding: 5rem 1.5rem 2rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .search-input {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 2.25rem;
    }

    .admin-main {
        padding: 4.5rem 1rem 1.5rem;
    }

    .users-table-container {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .users-table th,
    .users-table td {
        padding: 1rem;
        font-size: 0.85rem;
    }

    /* Horizontal scroll indicator hint */
    .users-table-container::after {
        content: '↔ Défilez horizontalement';
        display: block;
        text-align: center;
        padding: 0.75rem;
        font-size: 0.75rem;
        color: var(--text-light);
        background: rgba(0, 0, 0, 0.03);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* Login Mobile Adjustments */
    .login-container {
        padding: 2rem;
        width: 90%;
        margin: auto;
    }

    .login-header h1 {
        font-size: 2rem;
    }

    .settings-group,
    .admin-form-card {
        padding: 1.5rem;
    }
}

/* Ensure horizontal scrolling for all tables */
.users-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.users-table {
    min-width: 800px;
    /* Minimum width to prevent squishing */
}