/* ========================================
   Admin Panel Styles
   ======================================== */

:root {
    --admin-sidebar-w: 240px;
    --admin-header-h: 56px;
}

body.admin-body {
    background: #f1f5f9;
}

/* --- Login Page --- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1652f0 0%, #6366f1 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-card .login-logo .logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #1652f0, #6366f1);
    border-radius: 12px;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 12px;
}

.login-card .login-logo h1 {
    font-size: 20px;
    font-weight: 700;
}

.login-card .login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.login-form input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 82, 240, 0.1);
}

.login-form button {
    padding: 11px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-top: 8px;
}

.login-form button:hover {
    background: var(--primary-dark);
}

.login-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-error {
    color: var(--red);
    font-size: 13px;
    text-align: center;
    min-height: 18px;
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

/* --- Admin Layout --- */
.admin-layout {
    display: grid;
    grid-template-columns: var(--admin-sidebar-w) 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: #1e293b;
    color: #cbd5e1;
    padding: 0;
    position: fixed;
    width: var(--admin-sidebar-w);
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid #334155;
}

.admin-sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.admin-sidebar-header .logo .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #1652f0, #6366f1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}

.admin-sidebar nav {
    padding: 12px 0;
}

.admin-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    font-size: 14px;
    color: #cbd5e1;
    transition: all 0.15s ease;
}

.admin-sidebar nav a:hover {
    background: #334155;
    color: #fff;
}

.admin-sidebar nav a.active {
    background: var(--primary);
    color: #fff;
}

.admin-sidebar nav a .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.admin-sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid #334155;
    margin-top: auto;
}

.admin-sidebar-footer a {
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-sidebar-footer a:hover {
    color: #fff;
}

/* --- Admin Main --- */
.admin-main {
    margin-left: var(--admin-sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: var(--admin-header-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-header .admin-title {
    font-size: 16px;
    font-weight: 600;
}

.admin-header .admin-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.admin-content {
    flex: 1;
    padding: 24px;
}

/* --- Admin Content --- */
.admin-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.admin-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.admin-card-body {
    padding: 20px;
}

/* --- Admin Table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.admin-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

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

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Admin Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
    color: var(--text-primary);
}

.btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-danger {
    color: var(--red);
    border-color: var(--border);
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: var(--red);
    color: var(--red);
}

/* --- Admin Forms --- */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-row input,
.form-row textarea,
.form-row select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 82, 240, 0.1);
}

.form-row textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.form-row select {
    cursor: pointer;
}

/* --- Status Badge --- */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.published {
    background: #dcfce7;
    color: #16a34a;
}

.status-badge.draft {
    background: #fef3c7;
    color: #d97706;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 640px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* --- Stats Grid --- */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.admin-stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.admin-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        display: none;
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .modal {
        width: 95vw;
    }
}
