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

:root {
    --primary: #c4122f;
    --primary-hover: #a50e26;
    --primary-light: #fef2f2;
    --navy: #0c2340;
    --navy-dark: #071527;
    --navy-light: #16365c;
    --slate: #64748b;
    --slate-dark: #334155;
    --slate-light: #f1f5f9;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0284c7;
    --info-light: #f0f9ff;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
    background-color: var(--bg-page);
    color: #1e293b;
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* -------------------------------------------------------------
   Layout Structure
   ------------------------------------------------------------- */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 260px;
    background: var(--navy);
    color: #ffffff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 100;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
}

.sidebar-brand img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.sidebar-brand-text h1 {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
}

.sidebar-brand-text span {
    font-size: 11px;
    color: #94a3b8;
    display: block;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 20px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    padding: 12px 12px 6px;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: right;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
}

.nav-item.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(196, 18, 47, 0.35);
}

.nav-item .nav-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.nav-badge {
    margin-right: auto;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: var(--navy-dark);
}

.user-snippet {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 15px;
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: #94a3b8;
}

.btn-logout {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.btn-logout:hover {
    color: #ef4444;
}

/* Main Content Area */
.app-main {
    flex-grow: 1;
    margin-right: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* Top App Bar */
.app-header {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
}

.page-title-wrap h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--navy);
}

.page-title-wrap p {
    font-size: 12px;
    color: var(--slate);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-live-store {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--slate-light);
    color: var(--slate-dark);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.btn-live-store:hover {
    background: #e2e8f0;
}

/* Main Body Views */
.app-content {
    padding: 28px;
    flex-grow: 1;
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------
   Stat Cards & Grid
   ------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-info .stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate);
    margin-bottom: 6px;
}

.stat-info .stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.2;
}

.stat-info .stat-sub {
    font-size: 12px;
    color: var(--slate);
    margin-top: 6px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.red { background: var(--primary-light); color: var(--primary); }
.stat-icon.blue { background: var(--info-light); color: var(--info); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.navy { background: #f1f5f9; color: var(--navy); }

/* Highlight Net Collected Card */
.stat-card.highlight {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: #334155;
    color: #ffffff;
}

.stat-card.highlight .stat-info .stat-label { color: #94a3b8; }
.stat-card.highlight .stat-info .stat-value { color: #38bdf8; }
.stat-card.highlight .stat-info .stat-sub { color: #cbd5e1; }
.stat-card.highlight .stat-icon { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }

/* -------------------------------------------------------------
   Content Cards, Tables & Toolbar
   ------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Filter Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.search-box {
    position: relative;
    flex-grow: 1;
    min-width: 240px;
}

.search-box input {
    width: 100%;
    padding: 9px 38px 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196,18,47,0.1);
}

.search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate);
    pointer-events: none;
}

.select-filter {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: #ffffff;
    color: var(--slate-dark);
    outline: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: #ffffff;
    border-color: var(--border);
    color: var(--slate-dark);
}

.btn-secondary:hover {
    background: var(--slate-light);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

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

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: #f8fafc;
    color: var(--slate-dark);
    font-weight: 700;
    text-align: right;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-pending { background: #fef3c7; color: #b45309; }
.badge-payment-proof { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-payment-confirmed { background: #e0e7ff; color: #4338ca; }
.badge-processing { background: #e0f2fe; color: #0369a1; }
.badge-shipped { background: #f3e8ff; color: #6b21a8; }
.badge-delivered, .badge-completed { background: #dcfce7; color: #15803d; }
.badge-cancelled, .badge-refunded { background: #f1f5f9; color: #475569; }

.badge-instock { background: #dcfce7; color: #166534; }
.badge-lowstock { background: #fef3c7; color: #92400e; }
.badge-outofstock { background: #fee2e2; color: #991b1b; }

/* -------------------------------------------------------------
   Modal Dialogs
   ------------------------------------------------------------- */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.2s ease-out;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 14px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Form Groups */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--slate-dark);
    margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196,18,47,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* -------------------------------------------------------------
   Receipt Preview Zoom Box
   ------------------------------------------------------------- */
.receipt-zoom-container {
    text-align: center;
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.receipt-zoom-container img {
    max-width: 100%;
    max-height: 380px;
    border-radius: 4px;
    cursor: zoom-in;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* -------------------------------------------------------------
   Toasts Notification System
   ------------------------------------------------------------- */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1e293b;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    animation: slideInLeft 0.3s ease;
}

.toast.success { border-right: 4px solid var(--success); }
.toast.error { border-right: 4px solid var(--danger); }
.toast.info { border-right: 4px solid var(--info); }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* -------------------------------------------------------------
   Print Invoice Styles
   ------------------------------------------------------------- */
@media print {
    body * { visibility: hidden; }
    .print-area, .print-area * { visibility: visible; }
    .print-area { position: absolute; left: 0; top: 0; width: 100%; }
}

/* -------------------------------------------------------------
   Mobile & Responsive Adaptations
   ------------------------------------------------------------- */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-right: 0;
    }
    .menu-toggle-btn {
        display: block;
    }
    .app-header {
        padding: 0 16px;
    }
    .app-content {
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------------------------------
   Bulk Excel Import Module Styles
   ------------------------------------------------------------- */
.import-steps-bar {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 24px;
    padding: 0 10px;
}
.import-steps-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    right: 30px;
    left: 30px;
    height: 3px;
    background: var(--border);
    z-index: 1;
}
.import-step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    padding: 0 12px;
}
.import-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--slate-light);
    color: var(--slate);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    margin-bottom: 8px;
}
.import-step-item.active .import-step-circle {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(196, 18, 47, 0.15);
}
.import-step-item.completed .import-step-circle {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.import-step-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--slate);
}
.import-step-item.active .import-step-label {
    color: var(--navy);
    font-weight: 800;
}

/* Dropzone */
.dropzone-container {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background: #f8fafc;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}
.dropzone-container:hover, .dropzone-container.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.dropzone-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: inline-block;
}

/* File Selected Card */
.file-selected-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-top: 16px;
}
.file-meta-icon {
    font-size: 32px;
    margin-left: 14px;
}

/* Stats Pill Grid */
.import-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.import-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.import-summary-card.success { border-color: #bbf7d0; background: #f0fdf4; }
.import-summary-card.warning { border-color: #fde68a; background: #fffbeb; }
.import-summary-card.danger { border-color: #fecaca; background: #fef2f2; }
.import-summary-card.info { border-color: #bae6fd; background: #f0f9ff; }
.summary-num {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}
.summary-label {
    font-size: 12px;
    color: var(--slate);
    font-weight: 600;
}

/* Progress Bar */
.import-progress-container {
    background: #e2e8f0;
    border-radius: 999px;
    height: 22px;
    width: 100%;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.import-progress-fill {
    background: linear-gradient(90deg, var(--primary) 0%, #e02424 100%);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

