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

:root {
    --primary-color: #0d47a1;
    --primary-dark: #1a2a6c;
    --primary-light: #1976d2;
    --secondary-color: #3866df;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f1f2f6;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --sidebar-bg: linear-gradient(180deg, #1a2a6c, #0d47a1);
    --sidebar-width: 260px;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.active {
    display: block;
}

.admin-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--white);
    position: relative;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.admin-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--white);
    text-decoration: none;
    font-size: 24px;
    font-weight: 700;
}

.admin-logo img {
    height: 35px;
    filter: brightness(0) invert(1);
}

.admin-logo i {
    font-size: 28px;
    color: var(--warning-color);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-right: 4px solid transparent;
}

.sidebar-nav ul li a:hover,
.sidebar-nav ul li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-right-color: var(--warning-color);
}

.sidebar-nav ul li a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s;
}

.sidebar-footer a:hover {
    color: var(--danger-color);
}

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.admin-header {
    background: var(--white);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
}

.admin-header h1 {
    flex: 1;
    font-size: 20px;
    color: var(--primary-color);
}

.admin-header h1 i {
    margin-left: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-light);
}

.logout-btn {
    color: var(--danger-color);
    font-size: 18px;
}

.admin-content {
    padding: 25px;
    flex: 1;
    max-width: 100%;
    overflow-x: auto;
}

/* For pages using main-content instead of admin-layout */
.main-content {
    margin-right: var(--sidebar-width);
    padding: 25px;
    min-height: 100vh;
    background: var(--bg-color);
    transition: margin-right 0.3s ease;
}

/* Make sidebar fixed for pages using main-content */
body:has(.main-content) .admin-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
}

@media (max-width: 991px) {
    .main-content {
        margin-right: 0;
        padding: 15px;
    }

    body:has(.main-content) .admin-sidebar {
        transform: translateX(100%);
    }

    body:has(.main-content) .admin-sidebar.active {
        transform: translateX(0);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
}

.stat-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.stat-info p {
    color: var(--text-light);
    font-size: 14px;
}

.profit-summary {
    background: linear-gradient(135deg, #1a2a6c, #0d47a1);
    color: var(--white);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2rem;
}

.profit-item {
    text-align: center;
}

.profit-item h4 {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.profit-item .amount {
    font-size: 2rem;
    font-weight: bold;
}

.profit-item .amount.green {
    color: #28a745;
}

.profit-item .amount.yellow {
    color: #ffc107;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.dashboard-card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.dashboard-card h2 {
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.dashboard-card h2 i {
    color: var(--primary-color);
}

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

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: linear-gradient(135deg, #1a2a6c, #0d47a1);
    color: var(--white);
    font-weight: 600;
    font-size: 13px;
}

.data-table th:first-child {
    border-radius: 0 8px 0 0;
}

.data-table th:last-child {
    border-radius: 8px 0 0 0;
}

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

.data-table td a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #cce5ff;
    color: #004085;
}

.status-shipped {
    background: #d4edda;
    color: #155724;
}

.status-out_for_delivery {
    background: #e2d9f3;
    color: #6f42c1;
}

.status-delivered {
    background: #28a745;
    color: #fff;
}

.status-returned {
    background: #f8d7da;
    color: #721c24;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.top-products {
    list-style: none;
}

.top-products li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.top-products li:last-child {
    border-bottom: none;
}

.top-products .rank {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #0d47a1, #1976d2);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.top-products .name {
    flex: 1;
    font-weight: 500;
}

.top-products .sold {
    color: var(--text-light);
    font-size: 14px;
}

.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #0d47a1, #1976d2);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 71, 161, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: var(--white);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #ffca2c);
    color: #333;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #e74c5c);
    color: var(--white);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

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

.form-card {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group label i {
    margin-left: 5px;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2a6c 0%, #0d47a1 50%, #1976d2 100%);
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.login-card .logo {
    text-align: center;
    font-size: 50px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

@media (max-width: 991px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: var(--sidebar-width);
        transform: translateX(100%);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        width: 100%;
    }

    .sidebar-toggle {
        display: block;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .profit-summary {
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .profit-item .amount {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-content {
        padding: 15px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .admin-header h1 {
        font-size: 16px;
    }
}