/* style.css - نسخة متجاوبة للموبايل 100% */

/* ================= الأساسيات ================= */
* {
    box-sizing: border-box; /* يمنع العناصر من الخروج عن العرض */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Tajawal', Tahoma, sans-serif;
    background-color: #f4f6f9;
    direction: rtl;
    color: #333;
    overflow-x: hidden; /* منع التمرير الأفقي للصفحة بالكامل */
    -webkit-tap-highlight-color: transparent; /* إزالة لون النقر الأزرق في أندرويد */
}

a { text-decoration: none; }

/* ================= الشريط العلوي ================= */
.top-nav {
    background: #fff;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 60px; /* زيادة الارتفاع للموبايل */
}

.brand-title {
    font-weight: bold;
    font-size: 18px;
    color: #1f2937;
}

/* زر القائمة */
#openSidebar {
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================= القائمة الجانبية (Sidebar) ================= */
.sidebar {
    position: fixed;
    top: 0;
    right: -280px; /* مخفية */
    width: 260px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease-in-out;
    z-index: 2000; /* فوق كل شيء */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.active {
    right: 0; /* تظهر */
}

.sidebar-content {
    padding: 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 15px; /* تكبير مساحة اللمس */
    color: #555;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: 0.2s;
    font-size: 16px;
    font-weight: 500;
}

.sidebar-link:hover, .sidebar-link:active {
    background-color: #f0f9ff;
    color: #2563eb;
}

.sidebar-link span { margin-left: 10px; font-size: 22px; }

/* الخلفية السوداء الشفافة */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1500; /* تحت القائمة وفوق الموقع */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.active {
    display: block;
    opacity: 1;
}

/* ================= المحتوى الرئيسي ================= */
.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px; /* حواف جانبية للموبايل */
    width: 100%;
}

/* الصناديق والبطاقات */
.points-box, .admin-card, .wallet-card, .warning-box {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}
.warning-box {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
    font-size: 14px;
}

/* ================= الجداول (أهم جزء للموبايل) ================= */
.table-responsive {
    width: 100%;
    overflow-x: auto; /* السماح بالتمرير الأفقي */
    -webkit-overflow-scrolling: touch; /* نعومة التمرير في الموبايل */
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 600px; /* إجبار الجدول على العرض الكامل */
}

.table th, .table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #eee;
    white-space: nowrap; /* منع التفاف النص */
}

.table th {
    background: #f9fafb;
    color: #666;
    font-weight: bold;
}

/* ================= الأزرار والحقول ================= */
.btn-primary, .btn-success, .btn-danger, .btn-warning, .action-btn {
    padding: 10px 18px; /* أزرار أكبر للمس */
    border-radius: 8px;
    border: none;
    color: white;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    text-align: center;
    transition: 0.2s;
    text-decoration: none;
}
.btn-primary { background: #2563eb; }
.btn-success { background: #10b981; }
.btn-danger { background: #ef4444; }
.btn-warning { background: #f59e0b; }
.btn-manage { background:#2563eb; } 
.btn-rename { background:#f39c12; } 
.btn-delete { background:#e74c3c; }

.btn-primary:active, .btn-success:active { transform: scale(0.98); }

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px; /* حجم مناسب للقراءة */
    background: #fff;
    margin-bottom: 10px;
}

/* ================= المتجر (الشبكة) ================= */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.shop-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

/* ================= التوست (الإشعارات) ================= */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    width: 90%; /* عرض مناسب للموبايل */
    max-width: 350px;
}
.toast {
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 10px;
    color: #fff;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(20px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background-color: #2ecc71; }
.toast-error { background-color: #e74c3c; }
.toast-info { background-color: #3498db; }

/* ================= تحسينات خاصة للموبايل (Media Query) ================= */
@media (max-width: 768px) {
    .main-container {
        padding: 0 10px;
        margin-top: 15px;
    }

    .shop-grid {
        grid-template-columns: 1fr; /* عمود واحد في الموبايل */
    }
    
    /* تكبير الأزرار في الجداول */
    .action-btn {
        padding: 8px 12px;
        margin: 2px;
        font-size: 13px;
    }
    
    /* تحسين الهيدر */
    .top-nav {
        padding: 10px 15px;
    }
    
    /* تحسين لوحة السيرفر */
    .stats-bar {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}