/* ==========================================================================
   1. المتغيرات وإعدادات الألوان (Variables)
   ========================================================================== */
:root {
    --bg-dark: #0f0f0f;
    --bg-card: #141414;
    --bg-panel: #1a1a1a;
    --gold: #D4AF37;
    --gold-light: #F8E79C;
    --gold-gradient: linear-gradient(135deg, #bf953f 0%, #fcf6ba 40%, #b38728 70%, #fbf5b7 100%);
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --danger: #ff4444;
    --success: #00C851;
    
    /* الخطوط */
    --font-ar: 'Noto Kufi Arabic', sans-serif;
    --font-en: 'Cinzel', serif;
}

/* ==========================================================================
   2. أساسيات الصفحة (Global Reset)
   ========================================================================== */
* { box-sizing: border-box; outline: none; }

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important; /* منع السكرول العرضي */
    margin: 0; padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    font-family: var(--font-ar);
}

body.ltr { font-family: var(--font-en); direction: ltr; }

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
img { max-width: 100%; height: auto; }

/* ==========================================================================
   3. النصوص الذهبية (Typography)
   ========================================================================== */
.gold-text, .wood-badge h2, .price, .section-title h2 {
    background: var(--gold-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
    .gold-text, .wood-badge h2, .price, .section-title h2 {
        background: none; color: var(--gold); -webkit-text-fill-color: var(--gold);
    }
}

/* ==========================================================================
   4. الهيدر الرئيسي للموقع (Frontend Header)
   ========================================================================== */
header {
    position: fixed; top: 0; width: 100%; z-index: 1000;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding: 15px 5%;
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.4s ease;
}

.wood-badge {
    border: 1px solid var(--gold); padding: 5px 20px; border-radius: 4px;
    text-align: center; background: #3e2723;
    background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 2px, transparent 2px, transparent 10px);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}
.wood-badge h2 { font-size: 1.5rem; margin: 0; line-height: 1.2; font-family: var(--font-en); }
.wood-badge span { display: block; font-size: 0.6rem; color: var(--gold-light); letter-spacing: 2px; text-transform: uppercase; }

.nav-links { display: flex; gap: 30px; }
.nav-links a { font-size: 1rem; color: #ccc; position: relative; }
.nav-links a:hover { color: var(--gold); }
.nav-links a::after {
    content: ''; position: absolute; bottom: -5px; inset-inline-start: 0;
    width: 0; height: 1px; background: var(--gold); transition: 0.3s;
}
.nav-links a:hover::after { width: 100%; }

.controls { display: flex; align-items: center; gap: 15px; }
.lang-btn {
    border: 1px solid #444; color: var(--gold); padding: 5px 12px;
    border-radius: 20px; font-size: 0.8rem; font-weight: bold; font-family: sans-serif;
}
.lang-btn:hover { border-color: var(--gold); background: rgba(212, 175, 55, 0.1); }

/* ==========================================================================
   5. الواجهة الرئيسية (Hero & Features)
   ========================================================================== */
.hero {
    min-height: 100vh; padding-top: 80px;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at center, #1f1f1f 0%, #000 80%);
}
.hero-content { text-align: center; z-index: 2; width: 90%; max-width: 800px; }
.hero h1 { font-size: 3.5rem; margin-bottom: 20px; font-family: var(--font-en); line-height: 1.2; }
.hero p { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 40px; max-width: 600px; margin-inline: auto; }
.hero-img {
    width: 250px; height: 250px; margin: 0 auto 30px;
    border-radius: 50%; border: 2px solid var(--gold); overflow: hidden;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.2);
    animation: float 6s ease-in-out infinite;
}
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

/* Features */
.features { padding: 80px 5%; background: #111; text-align: center; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-top: 40px; }
.feature-box { padding: 30px; border: 1px solid #333; border-radius: 8px; transition: 0.3s; }
.feature-box:hover { border-color: var(--gold); transform: translateY(-5px); }
.feature-box i { font-size: 2.5rem; color: var(--gold); margin-bottom: 20px; }
.feature-box h3 { margin-bottom: 10px; color: #fff; }

/* Promo Banner */
.promo-banner {
    padding: 100px 5%;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('https://images.unsplash.com/photo-1601053299351-5bb9aa9a2216?q=80&w=1000');
    background-size: cover; background-attachment: fixed; background-position: center;
    text-align: center; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold);
}
.promo-banner h2 { font-size: 2.5rem; color: #fff; font-family: var(--font-en); margin-bottom: 15px; }

/* ==========================================================================
   6. المنتجات (Products Grid)
   ========================================================================== */
.products { padding-block: 80px; padding-inline: 5%; background: #080808; }
.section-title { text-align: center; margin-bottom: 60px; }
.section-title h2 { font-size: 2.5rem; margin-bottom: 10px; font-family: var(--font-en); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; }
.card { background: var(--bg-card); border: 1px solid #222; padding: 15px; transition: 0.3s; position: relative; }
.card:hover { transform: translateY(-10px); border-color: var(--gold); }
.card-img { height: 300px; width: 100%; overflow: hidden; margin-bottom: 15px; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.card:hover .card-img img { transform: scale(1.1); }
.card h3 { margin: 10px 0 5px; font-size: 1.2rem; }
.price { font-size: 1.1rem; font-weight: bold; display: block; margin-bottom: 15px; }

/* Buttons */
.btn-gold, .btn-main {
    display: inline-block; padding: 12px 40px; border: 1px solid var(--gold);
    color: var(--gold); font-weight: bold; text-transform: uppercase;
    position: relative; overflow: hidden; z-index: 1; transition: 0.4s; background: transparent; cursor: pointer;
}
.btn-gold:hover, .btn-main:hover { color: #000; background: var(--gold); box-shadow: 0 0 20px rgba(212,175,55,0.4); }
.add-btn {
    width: 100%; padding: 10px; border: 1px solid #444; color: #fff;
    transition: 0.3s; font-family: inherit; cursor: pointer;
}
.card:hover .add-btn { background: var(--gold); border-color: var(--gold); color: #000; }

/* ==========================================================================
   7. النماذج والحقول (Forms & Inputs)
   ========================================================================== */
.form-input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
    width: 100%; padding: 15px; background: #111; border: 1px solid #333; color: #fff;
    border-radius: 4px; font-family: inherit; margin-bottom: 20px; transition: 0.3s;
}
.form-input:focus, input:focus, textarea:focus, select:focus {
    border-color: var(--gold); box-shadow: 0 0 10px rgba(212,175,55,0.1);
}
textarea { height: 150px; resize: none; }
label { color: #ccc; margin-bottom: 8px; display: block; font-weight: bold; }
input[type="file"] { padding: 10px; background: #222; }

/* ==========================================================================
   8. صفحة تواصل معنا (Contact Page Fix)
   ========================================================================== */
.page-header {
    height: 40vh; background: radial-gradient(circle, #222 0%, #000 100%);
    display: flex; align-items: center; justify-content: center; text-align: center; padding-top: 80px;
}

.contact-container {
    padding: 80px 5%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    max-width: 1200px; /* إصلاح توسع الصفحة */
    margin: 0 auto;    /* توسيط المحتوى */
}

/* ==========================================================================
   9. السلة (Cart)
   ========================================================================== */
.cart-container { padding: 80px 5%; min-height: 60vh; max-width: 1200px; margin: 0 auto; }
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
.cart-table th { text-align: start; padding: 20px; background: var(--bg-panel); color: var(--gold); border-bottom: 2px solid #333; }
.cart-table td { padding: 20px; border-bottom: 1px solid #222; vertical-align: middle; }
.product-info { display: flex; align-items: center; gap: 15px; }
.product-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 4px; border: 1px solid #444; }
.qty-input { width: 60px !important; padding: 8px; text-align: center; }
.remove-btn { color: var(--danger); font-size: 1.2rem; transition: 0.3s; }
.remove-btn:hover { transform: scale(1.2); }

.cart-summary { background: var(--bg-panel); border: 1px solid var(--gold); padding: 30px; max-width: 400px; margin-inline-start: auto; border-radius: 8px; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 15px; font-size: 1.1rem; }
.total-row { border-top: 1px solid #333; padding-top: 15px; margin-top: 15px; font-weight: bold; font-size: 1.4rem; color: var(--gold); }

/* ==========================================================================
   10. الفوتر (Footer)
   ========================================================================== */
footer { background-color: #050505; border-top: 1px solid var(--gold); padding: 60px 5% 20px; margin-top: 50px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-col h3 { color: #fff; margin-bottom: 20px; font-family: var(--font-en); }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: #888; transition: 0.3s; }
.footer-col ul li a:hover { color: var(--gold); padding-inline-start: 5px; }
.copyright { text-align: center; padding-top: 20px; border-top: 1px solid #222; color: #555; }

/* ==========================================================================
   11. لوحة التحكم (Admin Panel Styling)
   ========================================================================== */
.admin-container { 
    max-width: 1200px; margin: 0 auto; padding: 40px 20px; 
}

/* هيدر الأدمن */
.admin-header-layout { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 20px; background: #1a1a1a; 
    border-bottom: 1px solid #333; border-radius: 8px; margin-bottom: 30px; 
    flex-wrap: wrap; gap: 20px;
}

.admin-nav { display: flex; gap: 10px; align-items: center; }
.admin-nav a { 
    color: #ccc; padding: 10px 20px; background: #252525; border-radius: 30px; 
    font-size: 0.9rem; transition: 0.3s; display: flex; align-items: center; gap: 8px;
}
.admin-nav a:hover, .admin-nav a.active { 
    background: var(--gold); color: #000; font-weight: bold; 
}
.view-site { border: 1px solid #444; }
.logout-btn { background: rgba(255, 68, 68, 0.1) !important; color: var(--danger) !important; border: 1px solid var(--danger); }
.logout-btn:hover { background: var(--danger) !important; color: #fff !important; }

/* جداول الأدمن */
.admin-table { 
    width: 100%; border-collapse: collapse; background: var(--bg-panel); 
    border-radius: 8px; overflow: hidden; margin-top: 20px; 
}
.admin-table th { background: #252525; color: var(--gold); padding: 15px; text-align: center; border-bottom: 2px solid #333; }
.admin-table td { padding: 15px; text-align: center; border-bottom: 1px solid #333; }
.admin-table img { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; }

/* صفحة الدخول */
.login-body { display: flex; justify-content: center; align-items: center; height: 100vh; background: #000; }
.login-box { background: var(--bg-panel); padding: 40px; border: 1px solid var(--gold); border-radius: 8px; text-align: center; width: 100%; max-width: 400px; }
.login-btn { width: 100%; background: var(--gold); color: #000; padding: 12px; font-weight: bold; border-radius: 4px; transition: 0.3s; margin-top: 20px; cursor: pointer; }

/* ==========================================================================
   12. استجابة الموبايل (Mobile Responsiveness)
   ========================================================================== */
@media (max-width: 768px) {
    /* هيدر الموقع */
    header { flex-direction: column; gap: 15px; }
    .nav-links { gap: 15px; flex-wrap: wrap; justify-content: center; font-size: 0.9rem; }
    
    /* Layout */
    .hero h1, .page-header h1 { font-size: 2rem; }
    .contact-container { grid-template-columns: 1fr; padding-inline: 20px; }
    
    /* هيدر الأدمن */
    .admin-header-layout { flex-direction: column; text-align: center; }
    .admin-nav { flex-wrap: wrap; justify-content: center; width: 100%; }
    
    /* تحويل الجداول لكروت */
    .cart-table, .cart-table tbody, .cart-table tr, .cart-table td,
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td {
        display: block !important; width: 100% !important;
    }
    .cart-table thead, .admin-table thead { display: none !important; }
    
    .cart-table tr, .admin-table tr {
        margin-bottom: 20px; background: var(--bg-panel); border: 1px solid var(--gold); border-radius: 8px; padding: 15px;
    }
    
    .cart-table td, .admin-table td {
        text-align: right; padding: 10px 0; border-bottom: 1px solid #333; display: flex !important; justify-content: space-between; align-items: center;
    }
    .cart-table td:last-child, .admin-table td:last-child { border-bottom: none; }
    
    .cart-table td::before, .admin-table td::before {
        content: attr(data-label); font-weight: bold; color: var(--gold); margin-left: 10px;
    }
    .product-info { width: 100%; justify-content: flex-start; }
}
/* ==========================================================================
   تنسيق شريط تتبع الطلب (الأخضر الأفقي)
   ========================================================================== */
.track-timeline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    margin-top: 50px;
    padding: 0 10px;
}

.step {
    position: relative;
    text-align: center;
    flex: 1; /* يخلي كل العناصر تاخد نفس المساحة */
    z-index: 2;
}

/* الدائرة (الأيقونة) */
.step-icon {
    width: 50px;
    height: 50px;
    background: #222;       /* لون الخلفية غير النشط */
    color: #666;           /* لون الأيقونة غير النشط */
    border: 3px solid #444; /* حدود غير نشطة */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.2rem;
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
}

/* النص تحت الأيقونة */
.step-text {
    font-size: 0.85rem;
    color: #666;
    font-weight: bold;
    transition: 0.4s;
}

/* الخط الواصل بين الدوائر */
.step-line {
    position: absolute;
    top: 25px; /* في منتصف الدائرة */
    height: 4px;
    background: #333; /* لون الخط غير النشط */
    width: 100%;
    z-index: 1; /* خلف الدوائر */
    transition: 0.4s;
    
    /* ضبط مكان الخط حسب اتجاه اللغة */
    right: 50%; /* في العربي يبدأ من نص الدائرة ويمشي شمال */
}

/* في الإنجليزي نعكس الاتجاه */
html[dir="ltr"] .step-line {
    right: auto;
    left: 50%;
}

/* === الحالة النشطة (Active) - اللون الأخضر === */
.step.active .step-icon {
    background: #00C851; /* أخضر */
    border-color: #00C851;
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 200, 81, 0.5); /* وهج أخضر */
    transform: scale(1.1); /* تكبير بسيط */
}

.step.active .step-text {
    color: #fff;
}

/* تلوين الخط الواصل بالأخضر */
.step-line.active {
    background: #00C851;
}

/* للموبايل: تصغير العناصر */
@media (max-width: 600px) {
    .step-icon { width: 35px; height: 35px; font-size: 0.9rem; border-width: 2px; }
    .step-text { font-size: 0.65rem; display: none; /* ممكن نخفي النص في الموبايل لو ضيق */ }
    .step.active .step-text { display: block; /* نظهر النص للمرحلة النشطة بس */ }
    .step-line { top: 17px; height: 2px; }
}
/* ==========================================================================
   إصلاحات لوحة التحكم للموبايل (Admin Mobile Fixes)
   ========================================================================== */

/* 1. إصلاح الجداول (الرسائل والطلبات) */
.table-responsive {
    overflow-x: auto; /* يسمح بالسكرول يمين ويسار */
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

.admin-table {
    min-width: 800px; /* يجبر الجدول يفضل عريض عشان الكلام ميتفعصش */
    white-space: nowrap; /* يمنع الكلام ينزل سطر جديد */
}

/* 2. إصلاح هيدر الأدمن */
@media (max-width: 900px) {
    /* الحاوية الرئيسية للهيدر */
    .admin-header-layout {
        flex-direction: column; /* يرتب العناصر فوق بعض */
        gap: 15px;
        padding: 15px !important;
        text-align: center;
    }

    /* الروابط (المنتجات، الطلبات، إلخ) */
    .admin-nav {
        display: flex;
        flex-wrap: wrap; /* يسمح للأزرار تنزل سطر جديد */
        justify-content: center;
        gap: 10px;
        width: 100%;
    }

    .admin-nav a {
        font-size: 0.8rem; /* تصغير الخط شوية */
        padding: 8px 12px;
        flex-grow: 1; /* يخلي الأزرار تملا الفراغ */
        justify-content: center;
    }

    /* المحتوى العام */
    .admin-content {
        padding: 10px !important;
    }
    
    /* الفورم والأزرار */
    form input, form select, form button {
        width: 100% !important; /* يخلي الخانات بعرض الشاشة */
        margin-bottom: 10px;
    }
    
    /* شبكة العرض (Grid) */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important; /* يحول أي تقسيم لعمود واحد */
    }
}