/* style.css - تصميم الزجاج الاحترافي */

:root {
    /* المتغيرات الأساسية (يمكن للأدمن تغييرها لاحقاً) */
    --primary: #00f260;            /* اللون الرئيسي المضيء */
    --primary-dark: #0575e6;       /* تدرج لوني للزر */
    --accent: #ff4757;             /* لون التنبيهات */
    --bg-image: url('https://images.unsplash.com/photo-1534438327276-14e5300c3a48?q=80&w=1470'); /* خلفية افتراضية عالية الجودة */
    
    /* ألوان الزجاج */
    --glass-bg: rgba(20, 20, 20, 0.65);         /* لون خلفية الكروت (شفاف داكن) */
    --glass-border: rgba(255, 255, 255, 0.12);  /* حدود خفيفة جداً */
    --glass-shine: rgba(255, 255, 255, 0.05);   /* لمعة خفيفة */
    
    /* النصوص */
    --text-main: #ffffff;
    --text-muted: #b3b3b3;
}

/* === إعدادات عامة === */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #050505;
    background-image: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.9) 100%), var(--bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    direction: rtl;
    user-select: none;
    transition: background-image 0.5s ease;
}

/* شريط التمرير المخصص */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

/* === تصميم الزجاج (Glassmorphism) === */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255,255,255,0.2); /* لمعة علوية */
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

/* تأثير عند الضغط أو التحويم */
.glass-panel:active, .btn:active { transform: scale(0.98); }

/* === الهيكل الرئيسي === */
.app-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 600px; /* لجعله يشبه التطبيق على الشاشات الكبيرة */
    margin: 0 auto;
    position: relative;
    background: rgba(0,0,0,0.2);
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.main-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 120px; /* مسافة للبار السفلي */
    scroll-behavior: smooth;
}

/* === الهيدر (Header) === */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

#user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px; /* مربع بحواف دائرية (Modern) */
    background-image: url('https://i.pravatar.cc/150?img=12');
    background-size: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px var(--primary);
}

.status-dot {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#display-user-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

/* زر السلة في الهيدر */
.cart-btn {
    width: 45px;
    height: 45px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    backdrop-filter: blur(10px);
}
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    display: none; /* يظهر بالجافاسكريبت */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* === الأقسام والبطاقات === */
.section-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(to left, #fff, #bbb);
    
    -webkit-text-fill-color: transparent;
}

.training-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    position: relative;
}
.training-card::before {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}
.training-card h3 { margin: 0; font-size: 1.2rem; }
.training-card small { color: var(--text-muted); font-size: 0.9rem; }
.training-card i { color: var(--text-main); filter: drop-shadow(0 0 5px rgba(255,255,255,0.3)); }

/* === المتجر (Store Grid) === */
.search-bar { margin-bottom: 20px; position: sticky; top: 0; z-index: 10; }
.search-bar input { 
    backdrop-filter: blur(20px); 
    background: rgba(0,0,0,0.6); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.product-card {
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.product-img {
    width: 100%;
    height: 150px;
    background-color: #222;
    background-size: cover;
    background-position: center;
}

.product-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.product-info b { font-size: 0.95rem; display: block; margin-bottom: 4px; }
.product-info small { color: var(--text-muted); font-size: 0.8rem; }
.product-info span { 
    display: block; 
    margin-top: 8px; 
    color: var(--primary); 
    font-weight: 800; 
    text-shadow: 0 0 10px rgba(0, 242, 96, 0.3); 
}

.cart-icon-btn {
    position: absolute;
    top: 10px; left: 10px; /* يسار عشان العربية */
    background: rgba(0,0,0,0.7);
    width: 35px; height: 35px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white;
    backdrop-filter: blur(5px);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
}

.out-stock-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-weight: 900; font-size: 1.2rem;
    transform: rotate(-10deg);
    z-index: 5;
    text-transform: uppercase;
    border: 2px solid var(--accent);
    margin: 20px;
}

/* === الأزرار والمدخلات === */
.btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0, 242, 96, 0.3);
    text-align: center;
    display: flex; justify-content: center; align-items: center; gap: 10px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 12px;
    border-radius: 14px;
    width: 100%;
    font-weight: 700;
    margin-top: 10px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-outline:hover { background: rgba(0, 242, 96, 0.1); }

.btn-danger { background: var(--accent); color: white; border:none; padding:12px; border-radius:14px; width:100%; font-weight:bold; margin-top:10px; box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; border: none; background: var(--primary); color:black; font-weight:bold; cursor: pointer; }

.form-input, select.form-input, textarea.form-input {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: white;
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: 0.3s;
}
.form-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 242, 96, 0.2);
}

input[type="color"] { border: none; width: 100%; height: 50px; cursor: pointer; padding: 2px; border-radius: 10px; background: none; }

/* === الناف بار السفلي (Floating Dock) === */
.bottom-nav {
    position: fixed;
    bottom: 20px; left: 20px; right: 20px;
    height: 70px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    max-width: 560px; /* نفس عرض الكونتينر */
    margin: 0 auto;
    border-radius: 25px; /* شكل كبسولة */
    background: rgba(20, 20, 20, 0.85); /* أغمق قليلاً للتباين */
}

.nav-item {
    color: #888;
    text-align: center;
    font-size: 0.7rem;
    width: 60px;
    text-decoration: none;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nav-item i { font-size: 1.4rem; margin-bottom: 4px; transition: 0.3s; }

.nav-item.active { color: var(--primary); }
.nav-item.active i { transform: translateY(-5px); text-shadow: 0 0 10px var(--primary); }

/* === لوحة الدخول (Login) === */
#login-view {
    position: fixed; inset: 0;
    background-color: #000;
    background-image: linear-gradient(0deg, #000 0%, rgba(0,0,0,0.6) 100%), var(--bg-image);
    background-size: cover; background-position: center;
    z-index: 9990;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 30px;
    backdrop-filter: blur(5px);
}
#login-logo-container img { width: 140px; height: 140px; border-radius: 30px; object-fit: cover; margin-bottom: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
#login-view h1 { font-size: 2.5rem; margin-bottom: 40px; font-weight: 900; letter-spacing: -1px; }

/* === النوافذ المنبثقة (Modals) === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 6000;
    display: none; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
    width: 100%; max-width: 450px;
    padding: 30px;
    border-radius: 30px;
    max-height: 85vh; overflow-y: auto;
    animation: scaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.full-screen-modal {
    position: fixed; inset: 0;
    background: #111;
    z-index: 5000;
    overflow-y: auto;
    display: none;
    padding: 20px;
    padding-bottom: 100px;
    animation: slideUp 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; padding-top: 10px; }
.detail-header { height: 400px; position: relative; margin: -20px -20px 20px -20px; border-radius: 0 0 40px 40px; overflow: hidden; }
.detail-header img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.close-circle { position: absolute; top: 20px; right: 20px; background: rgba(0,0,0,0.5); width:40px; height:40px; display:flex; align-items:center; justify-content:center; border-radius: 50%; color: white; cursor: pointer; backdrop-filter:blur(5px); border:1px solid rgba(255,255,255,0.2); }

/* === الأزرار العائمة === */
.fab-add {
    position: fixed; bottom: 110px; left: 20px;
    width: 60px; height: 60px;
    background: var(--warning);
    color: black;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    z-index: 5001;
    box-shadow: 0 10px 20px rgba(255, 165, 2, 0.4);
    cursor: pointer;
    font-size: 1.5rem;
    transition: transform 0.2s;
}
.fab-add:hover { transform: scale(1.1) rotate(90deg); }

.support-fab {
    position: fixed; bottom: 110px; right: 20px;
    width: 60px; height: 60px;
    background: #25D366; /* WhatsApp Color */
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    z-index: 4000;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.4);
    transition: transform 0.2s;
}
.support-fab:hover { transform: scale(1.1); }

/* === الأنيميشن === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* === أدوات الأدمن والشبكة === */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.admin-card {
    padding: 20px;
    text-align: center;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 120px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    transition: 0.2s;
}
.admin-card:hover { background: rgba(255,255,255,0.08); border-color: var(--primary); }
.admin-card i { font-size: 2rem; color: var(--primary); margin-bottom: 10px; }

/* === إخفاء === */
.admin-only { display: none !important; }
.view-section { display: none; opacity: 0; transition: opacity 0.3s; }
.view-section.active { display: block; opacity: 1; }

#jitsi-container { border-radius: 20px; overflow: hidden; margin-top: 20px; border: 1px solid var(--glass-border); }
/* في ملف style.css استبدل تنسيق #lock-screen بهذا الكود القوي */

#lock-screen {
    position: fixed;       /* تثبيت بالنسبة للشاشة */
    inset: 0;              /* يغطي الشاشة من الـ 4 جهات (فوق، تحت، يمين، يسار) */
    width: 100vw;          /* عرض كامل */
    height: 100vh;         /* طول كامل */
    background-color: #000000; /* لون أسود معتم (ليس شفافاً) ليخفي التطبيق تحته */
    z-index: 99999999;     /* رقم عالي جداً ليكون فوق كل شيء بلا استثناء */
    display: none;         /* مخفي افتراضياً ويظهر بالجافاسكريبت */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    overflow: hidden;      /* منع السكرول */
}

/* تحسين شكل كارت الانستا باي داخل شاشة القفل */
.instapay-card {
    background: linear-gradient(135deg, #4f2c8d, #8e44ad);
    padding: 25px;
    border-radius: 20px;
    width: 100%;
    max-width: 350px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(79, 44, 141, 0.5);
    border: 1px solid rgba(255,255,255,0.1);
}
/* === تحسين تصميم مودال تفاصيل المنتج === */
#product-detail-modal .modal-content {
    padding: 0; /* إزالة الحواف الداخلية لتملأ الصورة العرض */
    overflow: hidden;
    background: #151515;
    border: 1px solid rgba(255,255,255,0.1);
}

.detail-header {
    width: 100%;
    height: 350px; /* تكبير الصورة */
    position: relative;
    background-color: #000;
}

.detail-header img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* إظهار المنتج بالكامل */
    backdrop-filter: blur(10px);
}

/* زر الإغلاق العائم */
.close-floating {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 10;
}

/* حالة التوفر أسفل الصورة */
.stock-badge {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 242, 96, 0.9); /* أخضر */
    color: black;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.stock-badge.out {
    background: rgba(255, 71, 87, 0.9); /* أحمر */
    color: white;
}

.detail-body {
    padding: 25px;
    position: relative;
    background: linear-gradient(to bottom, #1a1a1a, #0f0f0f);
    border-radius: 30px 30px 0 0; /* تدوير الحواف العلوية */
    margin-top: -30px; /* تداخل مع الصورة */
    z-index: 5;
}

.detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.detail-body h2 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
    width: 70%;
}

.detail-price {
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 800;
    text-shadow: 0 0 10px rgba(0, 242, 96, 0.2);
}

.detail-desc {
    color: #aaa;
    line-height: 1.6;
    font-size: 0.95rem;
    margin: 15px 0 25px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

/* التحكم في الكمية */
.qty-control-lg {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 5px;
    margin-right: 10px;
}
.qty-btn {
    width: 35px; height: 35px;
    background: transparent;
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}
.qty-input-display {
    width: 40px;
    text-align: center;
    background: transparent;
    border: none;
    color: white;
    font-weight: bold;
}

/* === تحسين قائمة المحافظات في السلة === */
select.form-input option {
    background-color: #1a1a1a;
    color: white;
    padding: 10px;
}
/* === إضافات الصور المتعددة === */
.multi-img-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.multi-img-item {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 5px;
}

/* === قسم المنتجات المشابهة === */
.related-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.related-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.related-card {
    min-width: 140px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
}
.related-img {
    width: 100%; height: 100px;
    background-size: cover; background-position: center;
    border-radius: 8px; margin-bottom: 5px;
}

/* === قسم التعليقات === */
.comments-section {
    margin-top: 30px;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 15px;
}
.comment-input-row {
    display: flex; gap: 10px; margin-top: 10px;
}
.comment-item {
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    position: relative;
}
.comment-user { color: var(--primary); font-weight: bold; font-size: 0.8rem; }
.comment-date { color: #666; font-size: 0.7rem; float: left; }
.comment-text { color: #ddd; margin-top: 5px; }
.delete-comment-btn {
    position: absolute; top: 10px; left: 10px;
    color: var(--accent); cursor: pointer; font-size: 0.8rem;
}