/* ============================================================
   admin.css — تصميم لوحة الإدارة
   Purple/violet accent — full sidebar layout — premium dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --bg-primary: #0a0d14;
    --bg-secondary: #10131c;
    --bg-card: #161b2e;
    --bg-card-hover: #1e2440;
    --sidebar-w: 240px;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --green: #22c55e;
    --amber: #f59e0b;
    --blue: #3b82f6;
    --danger: #ef4444;
    --success: #22c55e;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --border: rgba(255, 255, 255, 0.07);
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --font: 'Cairo', sans-serif;
    --topbar-h: 56px;
    --transition: 0.25s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse at 25% 25%, rgba(139, 92, 246, 0.2) 0%, transparent 55%), radial-gradient(ellipse at 75% 75%, rgba(99, 102, 241, 0.15) 0%, transparent 55%);
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: blobFloat 8s ease-in-out infinite alternate;
}

.blob1 {
    width: 480px;
    height: 480px;
    background: rgba(139, 92, 246, 0.15);
    top: -100px;
    right: -100px;
}

.blob2 {
    width: 320px;
    height: 320px;
    background: rgba(99, 102, 241, 0.12);
    bottom: -60px;
    left: -60px;
    animation-delay: -4s;
}

@keyframes blobFloat {
    from {
        transform: translate(0, 0)scale(1)
    }

    to {
        transform: translate(25px, 18px)scale(1.07)
    }
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(22, 27, 46, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 48px 40px;
    width: min(420px, 92vw);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px)scale(0.95)
    }

    to {
        opacity: 1;
        transform: translateY(0)scale(1)
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 20px var(--accent));
}

.login-logo h1 {
    font-size: 1.7rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 30%, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    padding-left: 44px;
}

.eye-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
    margin-bottom: 8px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 11px 22px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.loader {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* ===== Dashboard Layout ===== */
.dashboard-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transition: transform var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 18px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px var(--accent));
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent-light);
}

.sidebar-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--r-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all var(--transition);
}

.nav-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(139, 92, 246, 0.18);
    color: var(--accent-light);
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.sidebar-user {
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    border: 2px solid var(--accent-glow);
    flex-shrink: 0;
}

.user-name {
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.3;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.btn-icon-logout {
    margin-right: auto;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    transition: background var(--transition);
}

.btn-icon-logout:hover {
    background: rgba(239, 68, 68, 0.12);
}

/* Mobile topbar */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    z-index: 40;
}

.hamburger {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
}

.mobile-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--accent-light);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 49;
    backdrop-filter: blur(4px);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-w);
    padding: 32px 28px;
    max-width: calc(100vw - var(--sidebar-w));
    min-height: 100vh;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 24px;
}

.section-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-card.purple {
    border-color: rgba(139, 92, 246, 0.25);
    background: rgba(139, 92, 246, 0.07);
}

.stat-card.green {
    border-color: rgba(34, 197, 94, 0.25);
    background: rgba(34, 197, 94, 0.07);
}

.stat-card.amber {
    border-color: rgba(245, 158, 11, 0.25);
    background: rgba(245, 158, 11, 0.07);
}

.stat-card.blue {
    border-color: rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.07);
}

.stat-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--accent-light);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Two Column */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.card-body {
    padding: 0;
}

/* Tables */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    overflow-x: auto;
}

.data-table,
.mini-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.mini-table {
    min-width: 0;
}

.data-table thead,
.mini-table thead {
    background: rgba(255, 255, 255, 0.04);
}

.data-table th,
.mini-table th {
    padding: 13px 16px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td,
.mini-table td {
    padding: 13px 16px;
    font-size: 0.86rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.data-table tbody tr:last-child td,
.mini-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: rgba(139, 92, 246, 0.04);
}

.empty-cell {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Badges */
.badge {
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.badge-new {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-reserved {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-pickedup {
    background: rgba(251, 146, 60, 0.15);
    color: #fdba74;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.badge-delivered {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-cancelled {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Action Buttons in Table */
.btn-table {
    padding: 5px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-radius: var(--r-sm);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-table:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.btn-table.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-table-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 9px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--accent);
}

.filter-select option {
    background: var(--bg-card);
}

.btn-add {
    padding: 10px 20px;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

/* Settings */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 28px;
}

.settings-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.settings-msg {
    min-height: 24px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.settings-msg.success {
    color: var(--success);
}

.settings-msg.error {
    color: var(--danger);
}

.btn-save {
    padding: 12px 28px;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-save:hover {
    transform: translateY(-2px);
}

.pricing-example {
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--r-md);
    padding: 20px;
    font-size: 0.88rem;
    line-height: 2;
    color: var(--text-secondary);
}

.pricing-example strong {
    color: var(--accent-light);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 32px;
    width: min(480px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        transform: scale(0.85);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    transition: background var(--transition);
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 24px;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn-primary {
    width: auto;
    padding: 12px 28px;
}

/* Toast Container */
#toastContainer {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.hidden {
        display: none !important;
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-right: 0;
        padding: 80px 14px 20px;
        max-width: 100vw;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}