/* ==========================================
   Admin Panel Styles
   ========================================== */
:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --primary-light: #A29BFE;
    --dark: #2D3436;
    --dark-soft: #636E72;
    --gray: #B2BEC3;
    --gray-light: #DFE6E9;
    --gray-lighter: #F5F6FA;
    --white: #FFFFFF;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #E17055;
    --info: #74B9FF;
    --sidebar-width: 260px;
    --font-main: 'Inter', sans-serif;
    --radius: 12px;
    --transition: all 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-main);
    background: var(--gray-lighter);
    color: var(--dark);
    display: flex;
    min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
}
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}
.sidebar-logo i { color: var(--primary-light); }
.sidebar-badge {
    background: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    transition: var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: var(--primary); color: white; }
.nav-item i { width: 20px; text-align: center; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Main */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}
.admin-header {
    background: white;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--gray-light);
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-header h1 { font-size: 1.25rem; font-weight: 700; flex: 1; }
.sidebar-toggle { display: none; font-size: 1.2rem; color: var(--dark); }
.header-actions { display: flex; align-items: center; gap: 12px; font-weight: 500; }

.admin-content { padding: 32px; }

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.stat-icon.purple { background: #EDE7F6; color: var(--primary); }
.stat-icon.green { background: #E8F5E9; color: var(--success); }
.stat-icon.orange { background: #FFF3E0; color: #E67E22; }
.stat-icon.blue { background: #E3F2FD; color: var(--info); }
.stat-info h3 { font-size: 1.6rem; font-weight: 700; }
.stat-info p { font-size: 0.85rem; color: var(--dark-soft); }

/* Table */
.admin-table-wrapper {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.table-header h2 { font-size: 1.1rem; font-weight: 600; }
.table-actions { display: flex; gap: 8px; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th {
    text-align: left;
    padding: 12px 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dark-soft);
    background: var(--gray-lighter);
    border-bottom: 1px solid var(--gray-light);
    font-weight: 600;
}
.admin-table td {
    padding: 14px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray-light);
    vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover { background: var(--gray-lighter); }

.admin-table img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { border: 1px solid var(--gray-light); color: var(--dark-soft); background: white; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: 8px; transition: var(--transition); }
.btn-icon:hover { background: var(--gray-lighter); }

.action-btns { display: flex; gap: 4px; }
.action-btns button {
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: var(--transition);
}
.action-btns .edit { color: var(--primary); }
.action-btns .edit:hover { background: #EDE7F6; }
.action-btns .delete { color: var(--danger); }
.action-btns .delete:hover { background: #FFEBEE; }
.action-btns .view { color: var(--info); }
.action-btns .view:hover { background: #E3F2FD; }

/* Badge */
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: #E8F5E9; color: var(--success); }
.badge-warning { background: #FFF8E1; color: #E67E22; }
.badge-danger { background: #FFEBEE; color: var(--danger); }
.badge-info { background: #E3F2FD; color: #2196F3; }
.badge-primary { background: #EDE7F6; color: var(--primary); }
.badge-muted { background: var(--gray-lighter); color: var(--gray); }

/* Modal */
.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}
.admin-modal.show { display: flex; }
.modal-inner {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: 1.15rem; font-weight: 600; }
.modal-close { font-size: 1.2rem; color: var(--gray); }
.modal-close:hover { color: var(--dark); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-light);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary-light);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Loading */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 60px;
}
.loading-spinner::after {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-text { text-align: center; padding: 40px; color: var(--gray); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-light);
}
.page-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--dark-soft);
    transition: var(--transition);
}
.page-btn:hover { background: var(--gray-lighter); }
.page-btn.active { background: var(--primary); color: white; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .admin-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
}
