:root {
    --primary-color: #2F2F2F;
    --secondary-color: #A48A6D;
    --bg-color: #F5F2EC;
    --text-color: #666666;
    --white: #FFFFFF;
    --error-color: #e74c3c;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

header {
    background: var(--primary-color);
    color: var(--white);
    padding: 1.5rem;
    text-align: center;
}

header h1 span {
    color: var(--secondary-color);
}

/* الأقسام تظهر تحت بعض */
.products-grid {
    display: block;
    padding: 20px;
}

.products-grid > .product-card {
    display: inline-block;
    vertical-align: top;
    width: 250px;
    margin: 10px;
}

.product-card {
    background: #fff; /* أبيض واضح */
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(164, 138, 109, 0.10); /* ظل خفيف بلون ثانوي */
    padding: 18px 12px 12px 12px;
    margin-bottom: 18px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.product-card:hover {
    box-shadow: 0 6px 24px rgba(164, 138, 109, 0.18);
    transform: translateY(-4px) scale(1.03);
    background: #faf7f2; /* لون أفتح عند المرور */
}

.section-title {
    margin: 30px 0 10px 0;
    font-size: 1.2em;
    color: var(--primary-color);
    border-bottom: 1.5px solid #eee;
    padding-bottom: 5px;
}

.buy-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px;
    width: 100%;
    border-radius: 5px;
    cursor: pointer;
}

/* لوحة التحكم */
#login-section {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: var(--white);
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

#login-section input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: 'Tajawal';
}

#login-section button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.product-item {
    background: var(--white);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.delete-btn {
    background: var(--error-color) !important;
}
/* التصميم الجديد للوحة التحكم */
.mode-switch {
    display: flex;
    margin: 20px 0;
    gap: 10px;
}

.mode-switch button {
    flex: 1;
    padding: 10px;
    border: none;
    background: #eee;
    cursor: pointer;
}

.mode-switch button.active {
    background: var(--secondary-color);
    color: white;
}

.file-upload {
    margin: 15px 0;
}

.file-upload label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.product-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.product-image-preview {
    width: 60px;
    height: 60px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
    border-radius: 5px;
    overflow: hidden;
}

.product-image-preview img {
    max-width: 100%;
    max-height: 100%;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.save-btn {
    background: var(--secondary-color);
    color: white;
}

.delete-btn {
    background: #e74c3c;
    color: white;
}

.search-box {
    display: flex;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
}

.search-box button {
    padding: 10px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}
/* الإشعارات */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    transform: translateX(150%);
    transition: transform 0.3s ease-in-out;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: #f44336;
}

.toast.warning {
    background: #ff9800;
}
/* أنماط لوحة التحكم */
#login-section {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

#login-section input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: 'Tajawal';
}

.hint {
    color: #666;
    font-size: 0.8em;
    margin-top: 15px;
}

.admin-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.logout-btn {
    background: #e74c3c;
    color: white;
}

.reset-btn {
    background: #3498db;
    color: white;
}
/* أنماط السلة */
.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-left: 20px;
}

.cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.cart-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    transition: all 0.3s ease;
}

.cart-overlay.show {
    right: 0;
}

.cart-container {
    position: absolute;
    top: 0;
    right: 0;
    width: 90%;
    max-width: 400px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.cart-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f5f5f5;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
}

.cart-footer {
    padding: 15px;
    border-top: 1px solid #eee;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
}

.empty-cart {
    text-align: center;
    color: #777;
    padding: 20px;
}

/* تحسينات عامة */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.product-card {
    position: relative;
}

.add-to-cart {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart:hover {
    background: #8a6d4f;
}
.danger-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.danger-btn:hover {
    background-color: #c0392b;
}
.product-img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #f5f5f5;
    border-radius: 5px;
    margin-bottom: 15px;
}

.product-info {
    padding: 10px;
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #777;
}
.sar {
    font-family: 'Tajawal', Arial, sans-serif;
    font-weight: bold;
    margin-right: 2px;
}
.old-price {
    color: #888;
}
/* نافذة منبثقة */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;   /* يجعلها في منتصف الصفحة عموديًا */
    justify-content: center; /* يجعلها في منتصف الصفحة أفقيًا */
    z-index: 1000;
}
.modal-content {
    background: #fff;
    padding: 24px 20px 20px 20px;
    border-radius: 12px;
    max-width: 400px;
    width: 95%;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    text-align: center;
    max-height: 90vh;         /* أضف هذا السطر */
    overflow-y: auto;         /* وأضف هذا السطر */
    word-break: break-word;   /* وأضف هذا السطر */
    margin: 0 auto;
}
.close-modal {
    position: absolute;
    top: 10px; left: 10px;
    cursor: pointer;
    font-size: 28px;
    color: #888;
    transition: color 0.2s;
}
.close-modal:hover { color: #e74c3c; }
.modal-images {
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.modal-img {
    max-width: 90px;
    max-height: 90px;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #fafafa;
    object-fit: cover;
    transition: transform 0.2s;
}
.modal-img:hover {
    transform: scale(1.08);
    border-color: #aaa;
}
.modal-desc {
    color: #444;
    margin: 10px 0 6px 0;
    font-size: 15px;
    white-space: pre-line;      /* أضف هذا السطر */
    word-break: break-word;     /* وأضف هذا السطر */
    overflow-wrap: anywhere;    /* وأضف هذا السطر */
}
.modal-qty {
    color: #666;
    font-size: 14px;
    margin-bottom: 6px;
}
.modal-price {
    font-size: 17px;
    font-weight: bold;
    color: #1a8917;
    margin-bottom: 0;
}

.watch-video-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    margin: 10px 0 0 0;
    font-size: 15px;
}
.watch-video-btn:hover {
    background: #c0392b;
}
/* يمكنك إضافته في style.css */
.product-form {
    background: #fff;
    padding: 25px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    max-width: 420px;
    margin: 30px auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.product-form h2 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 1.3em;
}
.product-form input[type="text"],
.product-form input[type="number"],
.product-form textarea {
    padding: 10px;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    font-family: 'Tajawal', Arial, sans-serif;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
}
.product-form textarea {
    min-height: 60px;
    resize: vertical;
}
.product-form .file-upload {
    margin: 10px 0;
}
.product-form button.save-btn {
    background: var(--secondary-color);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 10px;
}
.product-form button.save-btn:hover {
    background: #8a6d4f;
}
.product-form .delete-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
}
.product-form .delete-btn:hover {
    background: #c0392b;
}
#categories-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.category-actions button {
    background: #eee;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
}
.category-actions button.delete-btn {
    background: #e74c3c;
    color: #fff;
}
.category-actions button.move-btn {
    background: #a48a6d;
    color: #fff;
}

.search-box {
    display: flex;
    gap: 8px;
    max-width: 400px;
    margin: 20px auto 0 auto;
}
.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}
.search-box button {
    padding: 10px 18px;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}