:root {
    --admin-navy: #0b2545;
    --admin-cyan: #0077b6;
    --admin-green: #059669;
    --admin-ink: #1e293b;
    --admin-muted: #64748b;
    --admin-line: #dbe5ee;
    --admin-soft: #f4f7fa;
    --admin-white: #fff;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background: var(--admin-soft);
    color: var(--admin-ink);
    font-family: Tajawal, Cairo, sans-serif;
}

body :where(button, input, select, textarea) {
    font: inherit;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
    direction: rtl;
    background: var(--admin-soft);
}

#admin-mobile-menu {
    position: fixed !important;
    z-index: 50 !important;
    inset: 0 0 0 auto !important;
    box-sizing: border-box;
    display: flex;
    width: 16rem !important;
    height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--admin-navy) !important;
    padding: 1rem;
    color: #fff !important;
    box-shadow: 0 12px 40px rgba(11, 37, 69, 0.2);
}

#admin-mobile-menu .admin-logo {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 4.5rem;
    margin: 0.25rem 0 1.25rem;
    border-radius: 0.75rem;
    background: #fff;
    padding: 0.4rem;
    object-fit: contain;
}

#admin-mobile-menu .side-links {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
}

#admin-mobile-menu .side-links a {
    display: flex;
    min-height: 2.65rem;
    align-items: center;
    border-radius: 0.55rem;
    padding: 0.65rem 0.8rem;
    color: #dce8f2 !important;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 140ms ease, color 140ms ease;
}

#admin-mobile-menu .side-links a:hover,
#admin-mobile-menu .side-links a.active,
#admin-mobile-menu .side-links a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
}

body:has(.dashboard-top) #admin-mobile-menu a[href="index.php"],
body:has(.admin-create-form) #admin-mobile-menu a[href="admins.php"],
body:has(.create-coupon-form) #admin-mobile-menu a[href="coupons.php"],
body:has(.ban-customer-form) #admin-mobile-menu a[href="customers.php"],
body:has(.dashboard-main table img) #admin-mobile-menu a[href="products.php"],
body:has(.order-status-form) #admin-mobile-menu a[href="orders.php"],
body:has(.profile-page) #admin-mobile-menu a[href="profile.php"],
body:has(.requests-page) #admin-mobile-menu a[href="requests.php"] {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
}

.admin-shell > .main,
.admin-shell > .dashboard-main,
.admin-shell > .profile-page,
.admin-shell > .requests-page,
.dashboard-main,
.profile-page,
.requests-page {
    box-sizing: border-box;
    min-width: 0;
    min-height: 100vh;
    margin-right: 16rem;
    margin-left: 0;
    flex: 1 1 auto;
    padding: clamp(1rem, 2.5vw, 2rem);
}

.dashboard-main,
.main.dashboard-main {
    overflow-x: auto;
}

.dashboard-top,
.topbar,
.requests-header {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-top h1,
.topbar h1,
.requests-header h1,
.dashboard-main h1,
.profile-page h1,
.requests-page h1 {
    color: var(--admin-navy);
    line-height: 1.45;
}

.stats,
.request-metrics {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.metric-card,
.stat,
.card,
.profile-card,
.requests-card,
.table-card,
.form-card {
    min-width: 0;
    border: 1px solid #e4ebf1;
    border-radius: 0.8rem;
    background: var(--admin-white);
    box-shadow: 0 6px 22px rgba(16, 35, 58, 0.05);
}

.metric-card,
.stat {
    padding: 1.15rem;
}

.metric-card small,
.stat small {
    display: block;
    color: var(--admin-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.metric-card strong,
.stat strong {
    display: block;
    margin-top: 0.45rem;
    color: var(--admin-navy);
    font-size: clamp(1.35rem, 2vw, 1.9rem);
    line-height: 1.25;
}

.section-label {
    margin: 1.5rem 0 0.75rem;
    color: var(--admin-navy);
    font-size: 1.1rem;
    font-weight: 800;
}

.table-card,
.requests-card {
    overflow: auto;
}

.table-card table,
.requests-card table,
.dashboard-main table,
.main table {
    width: 100%;
    border-collapse: collapse;
    color: #475569;
    font-size: 0.82rem;
    text-align: right;
}

.table-card table th,
.table-card table td,
.requests-card table th,
.requests-card table td,
.dashboard-main table th,
.dashboard-main table td,
.main table th,
.main table td {
    border-bottom: 1px solid #e8eef3;
    padding: 0.8rem 0.85rem;
    vertical-align: middle;
}

.table-card table thead,
.requests-card table thead,
.dashboard-main table thead,
.main table thead {
    background: #f1f5f9;
    color: var(--admin-navy);
}

.table-card table tbody tr:hover,
.requests-card table tbody tr:hover,
.dashboard-main table tbody tr:hover,
.main table tbody tr:hover {
    background: #f8fafc;
}

.dashboard-main table img,
.main table img {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.45rem;
    object-fit: contain;
    background: #f8fafc;
}

.actions,
.dashboard-main form.inline-block,
.main form.inline-block {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.action,
.dashboard-main button,
.dashboard-main input[type="submit"],
.profile-page button,
.requests-page button {
    min-height: 2.35rem;
    border-radius: 0.45rem;
    font-weight: 700;
}

.action {
    border: 1px solid #dce7ef;
    background: #edf5fb;
    color: var(--admin-cyan);
    padding: 0.4rem 0.65rem;
    cursor: pointer;
}

.action.danger,
.dashboard-main .text-red-600,
.main .text-red-600 {
    color: #b42318;
}

.dashboard-main form:not(.inline-block),
.dashboard-main .form-card,
.dashboard-main > section:has(input),
.dashboard-main > div:has(> form) {
    min-width: 0;
}

.dashboard-main label,
.requests-page label,
.profile-page label {
    display: block;
    color: var(--admin-navy);
    font-size: 0.83rem;
    font-weight: 700;
    line-height: 1.55;
}

.dashboard-main :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea),
.profile-page :where(input, select, textarea),
.requests-page :where(input:not([type="file"]), select, textarea),
.admin-login :where(input:not([type="checkbox"]), select, textarea) {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 2.6rem;
    border: 1px solid var(--admin-line);
    border-radius: 0.5rem;
    background: #fff;
    padding: 0.6rem 0.75rem;
    color: var(--admin-ink);
}

.dashboard-main textarea,
.requests-page textarea,
.profile-page textarea {
    min-height: 6rem;
    resize: vertical;
}

.dashboard-main :where(input, select, textarea):focus,
.profile-page :where(input, select, textarea):focus,
.requests-page :where(input, select, textarea):focus,
.admin-login :where(input, select, textarea):focus {
    border-color: var(--admin-cyan);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.12);
}

.dashboard-main input[type="file"],
.requests-page input[type="file"] {
    max-width: 100%;
    border: 1px dashed #b8c9d6;
    border-radius: 0.5rem;
    background: #f8fafc;
    padding: 0.55rem;
}

.form-grid,
.form-grid-2,
.profile-grid,
.admin-create-form,
.create-coupon-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.profile-card,
.form-card {
    padding: clamp(1rem, 3vw, 2rem);
}

.profile-content {
    width: min(100%, 48rem);
    margin-inline: auto;
}

.profile-grid .full,
.profile-grid .profile-field.full {
    grid-column: 1 / -1;
}

.profile-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 1.25rem;
}

.profile-submit,
.btn-green,
.requests-page button[type="submit"],
.dashboard-main button[type="submit"] {
    border: 0;
    background: var(--admin-green);
    color: #fff;
    padding: 0.65rem 1rem;
    cursor: pointer;
}

.profile-alert,
.request-alert {
    margin-bottom: 1rem;
    border: 1px solid #dce7ef;
    border-radius: 0.55rem;
    background: #fff;
    padding: 0.75rem 1rem;
}

.profile-alert.success,
.request-alert.success {
    border-color: #b8ead4;
    background: #e7faf2;
    color: #057a55;
}

.profile-alert.error,
.request-alert.error {
    border-color: #fecaca;
    background: #fff1f1;
    color: #b42318;
}

.status-badge,
.dashboard-main .rounded-full[class*="bg-"],
.main .rounded-full[class*="bg-"] {
    display: inline-flex;
    min-height: 1.5rem;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-pending { background: #fff7d6; color: #946200; }
.status-contacted { background: #e5f4ff; color: #006b9c; }
.status-completed { background: #e7faf2; color: #057a55; }
.status-cancelled { background: #fff0f0; color: #b42318; }

.admin-login {
    min-height: 100vh;
    background: #f4f7fa;
}

.admin-login main {
    box-sizing: border-box;
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.admin-login main > section {
    box-sizing: border-box;
    width: min(100%, 28rem);
    border: 1px solid #e4ebf1;
    border-radius: 1rem;
    background: #fff;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    box-shadow: 0 18px 55px rgba(11, 37, 69, 0.12);
}

.admin-login main > section form {
    display: grid;
    gap: 1rem;
}

.admin-login main > section > div > a {
    display: flex;
    width: 6rem;
    height: 5rem;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.admin-login main > section > div > a img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.min-w-0 { min-width: 0; }
.min-w-\[280px\] { min-width: 17.5rem; }
.min-w-\[650px\] { min-width: 40.625rem; }
.min-w-\[700px\] { min-width: 43.75rem; }
.min-w-\[900px\] { min-width: 56.25rem; }
.min-w-\[1240px\] { min-width: 77.5rem; }
.w-3\.5, .h-3\.5 { width: 0.875rem; height: 0.875rem; }
.p-2\.5 { padding: 0.625rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.pt-1\.5 { padding-top: 0.375rem; }
.resize-none { resize: none; }
.whitespace-nowrap { white-space: nowrap; }
.border-gray-200\/80 { border-color: rgba(229, 231, 235, 0.8); }
.border-slate-200\/80 { border-color: rgba(226, 232, 240, 0.8); }
.shadow-xs { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06); }
.shadow-2xs { box-shadow: 0 1px 1px rgba(15, 23, 42, 0.05); }
.hover\:bg-slate-50\/80:hover { background-color: rgba(248, 250, 252, 0.8); }
.hover\:bg-slate-200:hover { background-color: #e2e8f0; }
.hover\:bg-blue-100:hover { background-color: #dbeafe; }
.hover\:border-slate-400:hover { border-color: #94a3b8; }
.placeholder-red-300::placeholder { color: #fca5a5; }
.focus\:ring-1:focus { box-shadow: 0 0 0 1px currentColor; }
.focus\:border-red-400:focus { border-color: #f87171; }
.focus\:ring-red-200:focus { box-shadow: 0 0 0 3px #fecaca; }

.order-status-form {
    display: flex;
    min-width: 17.5rem;
    flex-direction: column;
    gap: 0.5rem;
}

.order-status-form select {
    width: 100%;
}

.delete-admin-form,
.reset-password-btn,
.delete-coupon-form,
.toggle-coupon-form,
.ban-customer-form,
.delete-customer-form,
.delete-order-form,
.edit-certificate-btn,
.delete-certificate-form {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.requests-table {
    width: 100%;
    min-width: 65.625rem;
}

.requests-card {
    max-width: 100%;
}

.admin-login .h-22 {
    height: 5.5rem;
}

.invoice-shell,
.invoice-page main {
    box-sizing: border-box;
    width: min(calc(100% - 2rem), 60rem);
    margin: 2rem auto;
    background: #fff;
    padding: clamp(1rem, 3vw, 2.5rem);
}

.invoice-page table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-page th,
.invoice-page td {
    border: 1px solid var(--admin-line);
    padding: 0.65rem;
    text-align: right;
}

.no-print { }

@media (min-width: 640px) {
    .stats,
    .request-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid,
    .form-grid-2,
    .profile-grid,
    .admin-create-form,
    .create-coupon-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .stats,
    .request-metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .admin-shell {
        display: block;
    }

    .admin-shell > .main,
    .admin-shell > .dashboard-main,
    .admin-shell > .profile-page,
    .admin-shell > .requests-page,
    .dashboard-main,
    .profile-page,
    .requests-page {
        width: 100%;
        margin: 0;
        padding: 4.25rem 0.85rem 1.25rem;
    }

    #admin-mobile-menu {
        transform: translateX(105%) !important;
        visibility: hidden;
        pointer-events: none;
    }

    #admin-mobile-menu.translate-x-0 {
        transform: translateX(0) !important;
        visibility: visible;
        pointer-events: auto;
    }

    #admin-mobile-menu-btn {
        position: fixed;
        z-index: 40;
        top: 0.85rem;
        right: 0.85rem;
        display: grid;
        width: 2.75rem;
        height: 2.75rem;
        place-items: center;
        border: 0;
        border-radius: 0.6rem;
        background: var(--admin-navy);
        color: #fff;
        cursor: pointer;
    }

    .admin-menu-close {
        display: block;
        align-self: flex-start;
        margin: 0 0 0.5rem;
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 1.75rem;
    }

    .dashboard-top,
    .topbar,
    .requests-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-card,
    .requests-card {
        max-width: 100%;
    }
}

@media print {
    .no-print,
    #admin-mobile-menu,
    #admin-mobile-menu-btn {
        display: none !important;
    }

    .invoice-page main {
        width: 100%;
        margin: 0;
        box-shadow: none;
    }
}