:root {
    --primary: #10542c;
    --primary-dark: #0a3d20;
    --secondary: #b99331;
    --gold-light: #d4af37;
    --bg: #f0f2f5;
    --white: #ffffff;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --danger: #d63031;
    --sidebar-width: 280px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

body {
    background: var(--bg);
    display: flex;
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

#adminLoginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 24px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: fadeInDown 0.6s ease;
}

.login-box i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary), #0a3d2e);
    color: white;
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
}

/* تحسين شكل شريط التحريك */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
}

.sidebar-logo {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo h2 {
    color: var(--secondary);
    font-size: 1.2rem;
    letter-spacing: 1px;
    margin-top: 0.8rem;
}

.sidebar-logo-circle {
    width: 100px;
    height: 100px;
    margin: 0 auto 0.5rem;
    box-sizing: border-box;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--secondary);
    background: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-logo-circle img {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: block;
    object-fit: contain;
    object-position: center center;
    transform: scale(1.06);
}

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

.sidebar-nav li {
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-nav li i {
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
}

.sidebar-nav li:hover,
.sidebar-nav li.active {
    background: var(--secondary);
    color: var(--primary-dark);
    transform: translateX(-5px);
    font-weight: 700;
}

.main-content {
    margin-right: var(--sidebar-width);
    flex-grow: 1;
    padding: 2rem;
    transition: var(--transition);
    max-width: calc(100vw - var(--sidebar-width));
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    background: var(--white);
    padding: 1.2rem 2rem;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.8rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.02);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.products {
    background: rgba(16, 84, 44, 0.1);
    color: var(--primary);
}

.stat-icon.orders {
    background: rgba(185, 147, 49, 0.1);
    color: var(--secondary);
}

.stat-info h3 {
    font-size: 1.8rem;
    line-height: 1;
}

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

.card {
    background: var(--white);
    padding: 2.2rem;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    margin-bottom: 2.5rem;
    border: 1px solid rgba(0, 0, 0, 0.02);
    animation: fadeIn 0.8s ease;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.card-header h3 {
    font-size: 1.3rem;
    color: var(--primary);
    position: relative;
    padding-right: 15px;
}

.card-header h3::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 25px;
    background: var(--secondary);
    border-radius: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
}

input,
textarea,
select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1.5px solid #edf2f7;
    border-radius: 12px;
    background: #f8fafc;
    transition: var(--transition);
    outline: none;
}

input:focus,
textarea:focus {
    border-color: var(--secondary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(185, 147, 49, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 1.1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    width: 100%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(16, 84, 44, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(16, 84, 44, 0.3);
}

.btn-primary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
}

.product-item {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #edf2f7;
    transition: var(--transition);
    position: relative;
}

.product-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

.product-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.product-item-content {
    padding: 1.2rem;
    text-align: center;
}

.product-item-content h4 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.delete-btn {
    background: rgba(214, 48, 49, 0.1);
    color: var(--danger);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    width: 100%;
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
}

.order-card {
    background: var(--white);
    padding: 1.8rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    border: 1.5px solid #edf2f7;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.order-card::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 6px;
    background: var(--secondary);
}

.order-card:hover {
    transform: scale(1.01);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px dashed #edf2f7;
    padding-bottom: 1rem;
    margin-bottom: 1.2rem;
}

.order-id {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.order-date {
    color: var(--text-light);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.order-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .order-details-grid {
        grid-template-columns: 1fr;
    }
}

.info-item {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.info-item i {
    color: var(--secondary);
    margin-top: 4px;
    width: 20px;
    text-align: center;
}

.info-item label {
    margin-bottom: 0;
    color: var(--text-light);
    font-size: 0.8rem;
    display: block;
}

.info-item span {
    font-weight: 600;
    color: var(--text-dark);
    display: block;
}

.order-items-box {
    background: #f8fafc;
    padding: 1.2rem;
    border-radius: 15px;
    border: 1px solid #edf2f7;
}

.order-items-box h5 {
    margin-bottom: 0.8rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-items-list {
    list-style: none;
}

.order-items-list li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-items-list li::before {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #2ecc71;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 992px) {
    #mobileMenuToggle { display: flex !important; }
    .sidebar { right: calc(-1 * var(--sidebar-width)); transform: none; }
    .sidebar.active { right: 0; box-shadow: -10px 0 30px rgba(0,0,0,0.2); }
    .main-content { margin-right: 0; padding: 1rem; max-width: 100vw; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
    .sidebar-logo-circle { width: 80px; height: 80px; }
}

.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

table th {
    color: var(--primary);
    font-weight: 700;
}

table td {
    vertical-align: middle;
}

.badge-low {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

canvas {
    max-height: 400px;
}