:root {
    --primary-color: var(--store-primary-color,#F2882C);
    --main-color: var(--primary-color);
    --dark-blue: #2c3e50;
    --bg-light: #f4f7f6;
    --text-dark: #333;
    --sidebar-width: 260px;
}

a{
    text-decoration: none;
}
body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 30px;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl; /* لضبط الاتجاه العربي */
    display: flex;
    justify-content: center;
    align-items: center;
}
.panel{
    position: fixed ;
    top: 0;
    background-color: #e74c3c;

}
/* حاوية النموذج */
.container {
    background: #ffffff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px; /* عرض مناسب للنموذج */
    text-align: center;
}

/* العنوان */
h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 28px;
}

/* تنسيق النموذج */
form {
    display: flex;
    flex-direction: column;
    text-align: right; /* محاذاة التسميات لليمين */
}

/* التسميات (Labels) */
label {
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

/* حقول الإدخال */
input[type="text"], 
input[type="email"],
input[type="password"],
input[type="number"] {
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus {
    border-color: var(--primary-color); /* اللون الرئيسي عند الضغط للكتابة */
}

/* زر تسجيل الدخول */
.back_btn,
button {
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
    text-align: center;
}
.back_btn {
        background-color: #5f5d74;

}

button:hover {
    background-color: var(--primary-color);
    filter: brightness(.92);
}

/* إضافة استجابة للموبايل */
@media (max-width: 480px) {
    .container {
        width: 90%;
        padding: 25px;
    }
}

/* ----------------------------------------------------------sidebar start */
/* إعدادات المتغيرات والألوان */
:root {
    --sidebar-bg: #1e293b;        /* لون خلفية غامق واحترافي */
    --sidebar-hover: #334155;    /* لون عند تمرير الماوس */
    --accent-green: var(--primary-color);     /* اللون الرئيسي من إعدادات المتجر */
    --text-light: #f8fafc;       /* لون النص الفاتح */
    --text-muted: #94a3b8;       /* لون نص ثانوي */
    --danger: #ef4444;           /* لون الخروج والحذف */
    --sidebar-width: 280px;
}

/* زر التحكم - Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle:hover {
    background: var(--accent-green);
    transform: scale(1.05);
}

/* الحاوية الرئيسية للسايدبار */
.sidebar_container {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar-bg);
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    color: var(--text-light);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
}

/* حالة الإخفاء */
.sidebar_container.hide {
    transform: translateX(var(--sidebar-width));
}

/* بروفايل الأدمن */
.admin_profile {
    padding: 40px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.admin_profile i {
    font-size: 3rem;
    color: var(--accent-green);
    margin-bottom: 15px;
    display: block;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.3));
}

.admin_profile span {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.sidebar_container h1 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 25px 25px 10px;
    letter-spacing: 1.5px;
    font-weight: 700;
}

/* قائمة الروابط - UL & LI */
.sidebar_container ul {
    list-style: none;
    padding: 0 15px;
    flex-grow: 1;
}

.sidebar_container ul li {
    margin-bottom: 8px;
}

/* تنسيق الروابط - A */
.sidebar_container ul li a {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    gap: 15px;
}

/* أيقونات الروابط */
.sidebar_container ul li a i {
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
}

/* تأثير التمرير والحالة النشطة */
.sidebar_container ul li a:hover, 
.sidebar_container ul li a.active {
    background-color: var(--sidebar-hover);
    color: var(--text-light);
}

.sidebar_container ul li a.active {
    background-color: var(--accent-green);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* رابط تسجيل الخروج */
.sidebar_container ul li.logout {
    margin-top: auto; /* دفع الزر للأسفل */
    padding-bottom: 25px;
}

.sidebar_container ul li.logout a:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* تعديل المحتوى الرئيسي */
.product_content {
    margin-right: var(--sidebar-width);
    padding: 30px;
    transition: margin-right 0.4s ease;
}

.product_content.expand {
    margin-right: 0;
}

/* التجاوب مع الشاشات الصغيرة */
@media (max-width: 768px) {
    .sidebar_container {
        transform: translateX(var(--sidebar-width));
    }
    .sidebar_container:not(.hide) {
        transform: translateX(0);
    }
    .product_content {
        margin-right: 0;
    }
}
/* ----------------------------------------------------------sidebar end */
/* ----------------------------------------------------------adminpanel start */

.admin_profile {
    text-align: center;
    padding: 30px 10px;
    background: rgba(0,0,0,0.2);
}




/* زر الجوال */
.mobile-toggle {
    display: none; /* مخفي في الكمبيوتر */
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--dark-bg);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1100;
}

/* --- التجاوب مع الجوال --- */
@media (max-width: 768px) {
    .sidebar_container {
        right: -100%; /* إخفاء القائمة خارج الشاشة يميناً */
    }

    .sidebar_container.open {
        right: 0; /* إظهارها عند الضغط على الزر */
    }

    .mobile-toggle {
        display: block; /* إظهار الزر في الجوال فقط */
    }

    /* جعل محتوى الصفحة الرئيسي يأخذ كامل العرض في الجوال */
    .content_sec {
        margin-right: 0 !important;
        padding: 20px;
        padding-top: 80px; /* ترك مساحة لزر الجوال */
    }
}

/* Main Content */
.content_sec {
    margin-right: var(--sidebar-width);
    padding: 40px;
    width: 100%;
}

.page_header { margin-bottom: 30px; }
.page_header h2 { color: var(--dark-blue); margin: 0; }

/* Cards Styling */
.form_card, .table_card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    margin-bottom: 30px;
}

.input_group { display: flex; gap: 10px; margin-top: 10px; }

input[type="text"] {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}

.add_btn {
    background: var(--main-color);
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: right;
    padding: 15px;
    background: #f8f9fa;
    color: #777;
    font-size: 14px;
}

tbody td { padding: 15px; border-top: 1px solid #eee; }

.badge {
    background: #e8f5e9;
    color: var(--main-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.btn_delete {
    background: #fff5f5;
    color: #e74c3c;
    border: 1px solid #fed7d7;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

.btn_delete:hover { background: #e74c3c; color: white; }
/* ----------------------------------------------------------adminpanel End */
/* ----------------------------------------------------------addproduct start */



:root {
    --main-color: var(--primary-color);
    --dark-blue: #2c3e50;
    --light-bg: #f8f9fa;
    --border-color: #ced4da;
}

main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--light-bg);
    padding: 20px;
    direction: rtl;
}

.form_product {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    width: 100%;
    max-width: 850px; /* عرض أكبر ليتناسب مع العمودين */
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin-top: 50px;
}

.form_product h1 {
    text-align: center;
    color: var(--dark-blue);
    margin-bottom: 30px;
    font-size: 26px;
    border-bottom: 3px solid var(--main-color);
    display: table;
    margin-right: auto;
    margin-left: auto;
    padding-bottom: 5px;
}

/* تحويل الفورم إلى شبكة عمودين */
.product_form_grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* عمودين متساويين */
    gap: 20px; /* المسافة بين الحقول */
}

.product_flags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
}

.product_flags label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
}

.product_flags input {
    width: auto;
}

.input_group {
    display: flex;
    flex-direction: column;
}

/* جعل الوصف والزر يأخذان العرض الكامل (العمودين) */
.full_width {
    grid-column: span 2;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
    font-size: 14px;
}

input[type="text"],
input[type="file"],
select,
textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: 0.3s ease-in-out;
    background-color: #fff;
    width: 100%;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--main-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

#button {
    grid-column: span 2; /* العرض الكامل */
    background-color: var(--main-color);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

#button:hover {
    background-color: var(--primary-color);
    filter: brightness(.92);
    transform: translateY(-2px);
}

/* --- الاستجابة للموبايل والأيباد --- */

/* للأجهزة اللوحية (Tablets) */
@media (max-width: 768px) {
    .form_product {
        max-width: 95%;
        padding: 20px;
    }
    .product_form_grid {
        gap: 15px;
    }
}

/* للموبايل (Mobile) */
@media (max-width: 500px) {
    .product_form_grid {
        grid-template-columns: 1fr; /* عمود واحد فقط */
    }
    .full_width, #button {
        grid-column: span 1;
    }
    .form_product h1 {
        font-size: 22px;
    }
}
/* ----------------------------------------------------------addproduct End */
/* ----------------------------------------------------------products View start */
//* الحاوية الرئيسية للمحتوى لضمان عدم تداخلها مع السايدبار */
.product_content {
    margin-right: 260px; /* نفس عرض السايدبار الثابت */
    padding: 40px;
    background-color: #f4f7f6;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* تنسيق الجدول */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* الهيدر الخاص بالجدول */
th {
    background-color: #2c3e50;
    color: #fff;
    font-weight: 600;
    padding: 15px;
    text-align: center;
    font-size: 14px;
}

/* الخلايا */
td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-align: center;
    vertical-align: middle;
    color: #555;
    font-size: 14px;
}

/* تنسيق صورة المنتج المصغرة */
td img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* تنسيق أزرار الإجراءات */
.delete, .update {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: 0.3s;
}

/* زر التعديل - أزرق */
.delete {
    background-color: #3498db;
    color: #fff;
}

.delete:hover {
    background-color: #2980b9;
}

/* زر الحذف - أحمر */
.update {
    background-color: #e74c3c;
    color: #fff;
}

.update:hover {
    background-color: #c0392b;
}

/* حالة الصف عند تمرير الماوس */
tr:hover {
    background-color: #fcfcfc;
}

/* --- التجاوب (Responsiveness) --- */

@media (max-width: 992px) {
    .product_content {
        margin-right: 0; /* في الموبايل السايدبار سيكون مخفياً أو منزلقاً */
        padding: 20px;
    }

    /* جعل الجدول قابلاً للتمرير الأفقي في الشاشات الصغيرة */
    .product_content {
        overflow-x: auto;
    }

    table {
        min-width: 800px; /* يمنع الجدول من الانضغاط بشكل مشوه */
    }
}
/* ----------------------------------------------------------products View  End */

/* Final responsive fixes for admin pages */
body.has-admin-sidebar {
    display: block;
    align-items: initial;
    justify-content: initial;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

body.has-admin-sidebar main,
body.has-admin-sidebar .content_sec,
body.has-admin-sidebar .product_content,
body.has-admin-sidebar .admin-container {
    box-sizing: border-box;
}

body.has-admin-sidebar .sidebar-toggle {
    display: flex;
    z-index: 3000;
    position: fixed;
    transition: background .25s ease, transform .25s ease, box-shadow .25s ease;
}

body.has-admin-sidebar .sidebar-toggle img {
    width: 24px;
    height: 24px;
    filter: invert(1);
}

body.has-admin-sidebar .sidebar_container {
    right: 0;
    transform: translateX(0);
    overflow-y: auto;
}

body.has-admin-sidebar .sidebar_container.hide {
    transform: translateX(var(--sidebar-width));
}

body.has-admin-sidebar .content_sec,
body.has-admin-sidebar .product_content {
    margin-right: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: none;
    padding-top: 40px;
}

body.has-admin-sidebar main {
    margin-right: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

body.has-admin-sidebar .admin-container {
    margin: 80px auto 30px;
    width: min(1200px, calc(100% - var(--sidebar-width) - 40px));
}

body.has-admin-sidebar table {
    min-width: 760px;
}

body.has-admin-sidebar .table_card,
body.has-admin-sidebar .admin-container,
body.has-admin-sidebar .product_content {
    overflow-x: auto;
}

@media (max-width: 768px) {
    body.has-admin-sidebar {
        padding: 0;
    }
    body.has-admin-sidebar .sidebar-toggle {
        top: 10px;
        right: 10px;
        width: 46px;
        height: 46px;
    }
    body.has-admin-sidebar .sidebar_container {
        width: min(86vw, var(--sidebar-width));
        transform: translateX(0);
    }
    body.has-admin-sidebar .sidebar_container.hide {
        transform: translateX(110%);
    }
    body.has-admin-sidebar .content_sec,
    body.has-admin-sidebar .product_content,
    body.has-admin-sidebar main {
        margin-right: 0;
        width: 100%;
        padding: 76px 12px 20px;
    }
    body.has-admin-sidebar .admin-container {
        width: calc(100% - 24px);
        margin: 76px 12px 20px;
        padding: 14px;
    }
    body.has-admin-sidebar .form_product {
        max-width: 100%;
        margin-top: 0;
        padding: 18px;
    }
    body.has-admin-sidebar .product_form_grid {
        grid-template-columns: 1fr;
    }
    body.has-admin-sidebar .full_width,
    body.has-admin-sidebar #button {
        grid-column: span 1;
    }
    body.has-admin-sidebar .input_group {
        flex-direction: column;
    }
body.has-admin-sidebar .input_group input,
    body.has-admin-sidebar .input_group button {
        width: 100%;
    }
    body.has-admin-sidebar table {
        min-width: 720px;
    }
}

/* Admin layout polish */
body.has-admin-sidebar .panel,
body.has-admin-sidebar .admin-card {
    position: static;
    top: auto;
    background: #fff;
}

.admin-page {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-message {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    line-height: 1.8;
    font-weight: 700;
}

.form-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.form-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.admin-page-header {
    background: transparent;
    margin-bottom: 4px;
}

.admin-page-header h1 {
    margin: 0 0 8px;
    color: var(--dark-blue);
    font-size: 28px;
}

.admin-page-header p {
    margin: 0;
    color: #64748b;
    line-height: 1.8;
}

.admin-card {
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    padding: 24px;
    margin: 0;
    box-sizing: border-box;
}

.admin-card h2 {
    margin: 0 0 18px;
    color: #1f2937;
    font-size: 20px;
}

.admin-form-card {
    max-width: 100%;
}

.admin-inline-form {
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: flex-end;
}

.admin-grid-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.admin-stack-form {
    display: grid;
    gap: 16px;
}

.admin-grid-form label,
.admin-stack-form label {
    display: block;
    margin-bottom: 8px;
}

.admin-grid-form input,
.admin-stack-form input,
.admin-stack-form textarea,
.admin-stack-form select,
.admin-inline-form input {
    margin-bottom: 0;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 6px;
    color: #2563eb;
    background: #eff6ff;
    margin: 2px;
    font-weight: 600;
}

.table-action.danger {
    color: #dc2626;
    background: #fef2f2;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
}

.stat-card {
    display: grid;
    gap: 10px;
}

.stat-card span {
    color: #64748b;
    font-weight: 600;
}

.stat-card strong {
    color: var(--dark-blue);
    font-size: 26px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
}

.page-link {
    min-width: 40px;
    padding: 10px 13px;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    font-weight: 700;
    text-align: center;
}

.page-link.active {
    background: var(--main-color);
    color: #fff;
    border-color: var(--main-color);
}

.page-link.disabled {
    opacity: .45;
    pointer-events: none;
}

@media (max-width: 768px) {
    .admin-card {
        padding: 16px;
        border-radius: 10px;
    }
    .admin-inline-form,
    .admin-grid-form {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }
    .admin-inline-form .add_btn,
    .admin-grid-form .action-btn,
    .admin-stack-form .action-btn {
        width: 100%;
    }
    .admin-page-header h1 {
        font-size: 24px;
    }
    .pagination {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .page-link {
        min-width: 38px;
        padding: 9px 11px;
    }
}
