/* Elite Admin — Premium Dashboard Theme */
/* Colors from App: primary=#C9A76B, primaryDark=#B38E4D, bg=#FAF8F4, bgSecondary=#F2EDE6 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

:root {
    --primary: #C9A76B;
    --primary-dark: #B38E4D;
    --primary-light: #D4B98B;
    --primary-10: rgba(201, 167, 107, 0.10);
    --primary-15: rgba(201, 167, 107, 0.15);
    --primary-20: rgba(201, 167, 107, 0.20);
    --bg: #FAF8F4;
    --bg2: #F2EDE6;
    --white: #FFFFFF;
    --text: #2A2A2A;
    --text2: #5A5A5A;
    --muted: #8E8E8E;
    --border: #E8E2D8;
    --success: #0D944D;
    --success-bg: rgba(13, 148, 77, 0.08);
    --warning: #D97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --error: #E53E3E;
    --error-bg: rgba(229, 62, 62, 0.08);
    --info: #1DA1F2;
    --info-bg: rgba(29, 161, 242, 0.08);
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

/* ==================== LAYOUT ==================== */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-left: 1px solid var(--border);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand img { width: 40px; height: 40px; border-radius: 10px; }
.sidebar-brand h2 { font-size: 18px; font-weight: 800; color: var(--text); }
.sidebar-brand span { font-size: 11px; color: var(--muted); font-weight: 600; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }

.nav-section { margin-bottom: 6px; }
.nav-section-title {
    font-size: 10px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 14px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
    position: relative;
}
.nav-link:hover { background: var(--primary-10); color: var(--primary-dark); }
.nav-link.active {
    background: var(--primary-15);
    color: var(--primary-dark);
    font-weight: 700;
}
.nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--primary-dark);
    border-radius: 0 3px 3px 0;
}
.nav-link .icon { font-size: 18px; opacity: 0.7; color: inherit; }
.nav-link.active .icon { opacity: 1; }
.nav-badge {
    margin-right: auto;
    background: var(--error);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 10px;
    line-height: 1.5;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
}
.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 14px;
}
.sidebar-footer .user-name { font-weight: 700; font-size: 13px; }
.sidebar-footer .user-role { font-size: 11px; color: var(--muted); }

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-w);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title { font-size: 20px; font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.page-content { padding: 24px 28px; }

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 800; }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }

/* ==================== STAT CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon.gold { background: var(--primary-10); color: var(--primary-dark); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.red { background: var(--error-bg); color: var(--error); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 900; line-height: 1.2; }
.stat-change { font-size: 11px; font-weight: 700; margin-top: 2px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }

/* ==================== TABLE ==================== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--bg);
    padding: 12px 16px;
    font-weight: 700;
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--primary-10); }
tbody tr:last-child td { border-bottom: none; }

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.success::before { background: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.warning::before { background: var(--warning); }
.badge.error { background: var(--error-bg); color: var(--error); }
.badge.error::before { background: var(--error); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.info::before { background: var(--info); }
.badge.muted { background: var(--bg2); color: var(--muted); }
.badge.muted::before { background: var(--muted); }
.badge.gold { background: var(--primary-10); color: var(--primary-dark); }
.badge.gold::before { background: var(--primary-dark); }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary-dark); color: white; }
.btn-primary:hover { background: var(--primary); color: white; }
.btn-outline { background: transparent; color: var(--primary-dark); border: 1px solid var(--primary-20); }
.btn-outline:hover { background: var(--primary-10); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-icon { padding: 6px 8px; font-size: 16px; }
.btn-icon:hover { background: var(--primary-10); }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    transition: border-color 0.15s;
    background: var(--white);
    color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-10); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238E8E8E'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; padding-left: 32px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary-dark); }
.form-inline { display: flex; gap: 8px; align-items: center; }

/* ==================== MODAL ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 540px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } }
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--muted); background: none; border: none; padding: 4px; }
.modal-close:hover { color: var(--error); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-start; }

/* ==================== ALERTS ==================== */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(13,148,77,0.15); }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(229,62,62,0.15); }

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 0;
    list-style: none;
}
.pagination li a, .pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--text2);
    transition: all 0.15s;
}
.pagination li a:hover { background: var(--primary-10); color: var(--primary-dark); }
.pagination li.active span { background: var(--primary-dark); color: white; }
.pagination li.disabled span { color: var(--muted); cursor: default; }

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--text2); }
.empty-state p { font-size: 13px; }

/* ==================== MISC ==================== */
.text-muted { color: var(--muted); }
.text-primary { color: var(--primary-dark); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-sm { font-size: 12px; }
.fw-800 { font-weight: 800; }
.d-flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ai-center { align-items: center; }
.jc-between { justify-content: space-between; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.product-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }

/* ==================== LOGIN ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 40px 32px;
    text-align: center;
}
.login-card img { width: 80px; height: 80px; border-radius: 16px; margin-bottom: 16px; }
.login-card h1 { font-size: 22px; font-weight: 900; margin-bottom: 4px; }
.login-card p { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.login-card .form-group { text-align: right; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* ==================== RESPONSIVE ==================== */
.sidebar-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); padding: 4px; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-right: 0; }
    .sidebar-toggle { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .page-content { padding: 16px; }
}
