/* ============================================================
   ADMIN PANEL STYLES
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

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

:root {
    --sidebar-w:   240px;
    --header-h:    60px;
    --primary:     #1a6060;
    --primary-d:   #124848;
    --gold:        #c9a84c;
    --pink:        #e8427d;
    --bg:          #f5f6fa;
    --white:       #ffffff;
    --border:      #e5e7eb;
    --text:        #1a1a1a;
    --text-muted:  #6b7280;
    --success:     #16a34a;
    --warning:     #d97706;
    --danger:      #dc2626;
    --info:        #2563eb;
    --font:        'Cairo', 'Arial', sans-serif;
    --radius:      10px;
    --shadow:      0 1px 6px rgba(0,0,0,0.08);
    --shadow-lg:   0 4px 20px rgba(0,0,0,0.10);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    direction: rtl;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ============================================================
   LAYOUT
   ============================================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .logo-icon { font-size: 28px; }
.sidebar-logo-text { font-size: 14px; font-weight: 800; }
.sidebar-logo-sub  { font-size: 11px; opacity: 0.7; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
    border-right: 3px solid transparent;
}
.sidebar-nav-item:hover,
.sidebar-nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-right-color: var(--gold);
}
.sidebar-nav-item .nav-icon { font-size: 18px; flex-shrink: 0; }

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    padding: 16px 16px 6px;
}

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

/* Main content area */
.admin-main {
    flex: 1;
    margin-inline-start: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top bar */
.admin-topbar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow);
}
.topbar-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.topbar-user .user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

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

/* ============================================================
   STATS CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.stat-icon.green  { background: #dcfce7; }
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.orange { background: #ffedd5; }
.stat-icon.purple { background: #f3e8ff; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 15px; font-weight: 700; }
.panel-body  { padding: 0; }

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: start;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

/* Product thumbnail in table */
.table-product-img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}
.table-product-info { display: flex; align-items: center; gap: 12px; }
.table-product-name { font-size: 14px; font-weight: 600; }
.table-product-sku  { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-delivered  { background: #dcfce7; color: #166534; }
.badge-cancelled  { background: #fee2e2; color: #991b1b; }
.badge-paid       { background: #dcfce7; color: #166534; }
.badge-failed     { background: #fee2e2; color: #991b1b; }
.badge-active     { background: #dcfce7; color: #166534; }
.badge-inactive   { background: #f3f4f6; color: #6b7280; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-gold      { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #b8933e; color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-outline   { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }

/* ============================================================
   FORMS (admin)
   ============================================================ */
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row.single { grid-template-columns: 1fr; }
.form-group-a { display: flex; flex-direction: column; gap: 6px; }
.form-label-a { font-size: 13px; font-weight: 600; color: var(--text); }
.form-input-a, .form-select-a, .form-textarea-a {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.form-input-a:focus, .form-select-a:focus, .form-textarea-a:focus {
    border-color: var(--primary);
}
.form-textarea-a { min-height: 100px; resize: vertical; }

/* Image upload preview */
.img-upload-preview {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 2px dashed var(--border);
    background: var(--bg);
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.flash-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.flash-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ============================================================
   PAGINATION (admin)
   ============================================================ */
.admin-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.page-link {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid var(--border);
    color: var(--text);
    background: var(--white);
    transition: all 0.15s;
    padding: 0 6px;
}
.page-link:hover,
.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; opacity: 0.4; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 13px; }

/* ============================================================
   SEARCH & FILTERS bar
   ============================================================ */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-wrap: wrap;
}
.filter-input {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    background: var(--white);
    min-width: 200px;
}
.filter-input:focus { border-color: var(--primary); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(100%); transition: transform 0.3s; }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-inline-start: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
