.admin-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

:root {
    --primary-color: #39888D;
    --dark-color: #1f2937;
    --gray-color: #6b7280;
    --bg-color: #f5f5f5;
    --success: #28a745;
    --danger: #dc3545;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* Improved controls */
.search-input {
    padding: 0.65rem 0.9rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(57,136,141,0.08);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.btn-primary:hover { opacity: 0.95; }

.btn-secondary {
    background: transparent;
    color: var(--dark-color);
    border: 1px solid #ddd;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

/* Focus-visible for accessibility */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(57,136,141,0.12);
    outline-offset: 2px;
}

/* Snackbar (undo) */
.snackbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
    background: #222;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 1200;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.snackbar button {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.role-disabled-note { font-size: 0.85rem; color: #666; margin-top: 6px; }

.admin-sidebar {
    width: 250px;
    background: var(--dark-color);
    color: white;
    padding: 2rem 0;
}

.admin-user {
    text-align: center;
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 2rem;
}

.user-avatar {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
}

.admin-user h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.admin-user p {
    color: #ccc;
    font-size: 0.9rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    padding: 0 1.5rem;
}

.admin-nav .nav-link {
    color: #ccc;
    text-decoration: none;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.admin-nav .nav-link:hover,
.admin-nav .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-nav .nav-link i {
    width: 20px;
}

.admin-main {
    flex: 1;
    padding: 2rem;
    background: #f5f5f5;
    overflow-y: auto;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-card:hover {
    transform: translateY(-4px);
    transition: transform 0.15s ease;
}

.stat-icon { position: relative; }
.stat-icon::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0,0,0,0.06);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-info h3 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
    color: var(--dark-color);
}

.stat-info p {
    color: var(--gray-color);
    font-size: 0.9rem;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h1 {
    margin: 0;
}

/* Tables */
.admin-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-table thead {
    background: var(--dark-color);
    color: white;
}

.admin-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.admin-table tbody tr {
    border-bottom: 1px solid #eee;
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.admin-table td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

/* Skeleton loading for stats */
.stats-grid.loading .stat-info h3,
.stats-grid.loading .stat-info p {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: shimmer 1.2s linear infinite;
    color: transparent;
    border-radius: 4px;
    height: 1.1em;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-edit {
    background: #28a745;
    color: white;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-view {
    background: var(--primary-color);
    color: white;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.category-card h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.category-card p {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.category-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.preview-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
}

/* Dashboard Charts */
.dashboard-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.analytics-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 300px;
}

.analytics-card canvas {
    max-height: 250px;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        padding: 1rem 0;
    }
    
    .admin-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 1rem;
    }
    
    .admin-nav .nav-link {
        flex-direction: column;
        padding: 0.5rem;
        font-size: 0.8rem;
        min-width: 80px;
    }
    
    .admin-nav .nav-link i {
        margin-bottom: 0.3rem;
    }
    
    .admin-main {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}