:root {
    --primary-bg: #1a1a2e;
    --secondary-bg: #16213e;
    --sidebar-bg: #0f3460;
    --card-bg: #1f4068;
    --text-primary: #e94560;
    --text-secondary: #ffffff;
    --text-muted: #a7a9be;
    --gold: #FFBD59;
    --success: #25D366;
    --danger: #e94560;
    --border-color: #333;
    --font-family: 'Poppins', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--primary-bg);
    color: var(--text-secondary);
}

#root {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* --- Loader & Access Denied --- */
.loading-container, .access-denied-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
}

.loading-container h2, .access-denied-container h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.access-denied-container a {
    color: var(--gold);
    text-decoration: none;
    background-color: var(--card-bg);
    padding: 10px 20px;
    border-radius: 5px;
    margin-top: 1.5rem;
    transition: background-color 0.3s;
}

.access-denied-container a:hover {
    background-color: #2a5288;
}

/* --- Main Dashboard Layout --- */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    padding: 1.5rem 1rem;
    position: fixed;
    top: 0;
    left: -250px;
    height: 100%;
    z-index: 1000;
    transition: left 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 2rem;
}

.sidebar-header h2 {
    color: var(--gold);
    font-size: 1.5rem;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease;
}

.sidebar-nav li a.active,
.sidebar-nav li a:hover {
    background-color: var(--card-bg);
    color: var(--gold);
}

.sidebar-nav li a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.user-profile {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.user-profile img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    background-color: var(--secondary-bg);
}

.user-profile p {
    font-size: 0.9rem;
    font-weight: 500;
}

.user-profile small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 1rem;
    margin-left: 0;
    transition: margin-left 0.3s ease-in-out;
    width: 100%;
    overflow-x: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
}

.mobile-menu-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    padding: 0.5rem;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.overlay.visible {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

/* --- Cards & Components --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--gold);
    overflow: hidden;
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--gold);
}

.stat-info .value {
    font-size: 2rem;
    font-weight: 700;
}
.stat-info .label {
    color: var(--text-muted);
}

.card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.card-header h3 {
    color: var(--gold);
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-primary {
    background-color: var(--gold);
    color: var(--primary-bg);
}
.btn-primary:hover {
    opacity: 0.9;
}
.btn-danger {
    background-color: var(--danger);
    color: var(--text-secondary);
}

/* Table styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}

.data-table thead {
    background-color: var(--secondary-bg);
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}
.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: #2a5288;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-buttons .btn {
    padding: 5px 10px;
    font-size: 0.9rem;
}

.status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}
.status.pending { background-color: #ff9f43; color: var(--primary-bg); }
.status.completed { background-color: var(--success); color: var(--primary-bg); }
.status.cancelled { background-color: var(--danger); color: var(--text-secondary); }


/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 1rem;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--gold);
}

/* Permissions Page */
.permission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--secondary-bg);
    border-radius: 5px;
    margin-bottom: 1rem;
}

.permission-label {
    font-weight: 500;
}

.add-admin-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
.add-admin-form input {
    flex-grow: 1;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--success);
}
input:focus + .slider {
    box-shadow: 0 0 1px var(--success);
}
input:checked + .slider:before {
    transform: translateX(22px);
}

.save-permissions-btn {
    margin-top: 1.5rem;
    width: 100%;
    justify-content: center;
}
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success);
    color: var(--primary-bg);
    padding: 12px 20px;
    border-radius: 5px;
    z-index: 2000;
    font-weight: 600;
}


/* Media Queries */
@media (min-width: 768px) {
    .sidebar {
        left: 0;
        width: 250px;
    }
    .main-content {
        margin-left: 250px;
        padding: 2rem;
    }
    .mobile-menu-toggle {
        display: none;
    }
    .overlay {
        display: none !important;
    }
}