/* ==========================================
   1. الإعدادات العامة والخطوط
   ========================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    direction: rtl;
    color: #2c3e50;
    line-height: 1.6;
}

html {
    scroll-behavior: smooth;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* ==========================================
   2. الترويسة والعلامة التجارية (Header)
   ========================================== */
header {
    background: linear-gradient(135deg, #1f4068, #162447);
    color: white;
    padding: 35px 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

header p {
    margin: 8px 0 0 0;
    color: #a0aec0;
    font-size: 1.1rem;
}

.logo-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 28px;
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.map-location-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    margin-top: 12px;
}

.map-location-btn:hover {
    background: #ffffff;
    color: #007bff;
    transform: translateY(-2px);
}

/* ==========================================
   3. التنقل السريع والأقسام
   ========================================== */
.quick-nav {
    text-align: center;
    margin: 25px 0;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.quick-btn {
    background: #ffffff;
    color: #3182ce;
    border: 2px solid #3182ce;
    padding: 8px 22px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.quick-btn.used-nav {
    color: #b7791f;
    border-color: #d69e2e;
}

.quick-btn:hover {
    background: #3182ce;
    color: #fff;
    transform: translateY(-2px);
}

.quick-btn.used-nav:hover {
    background: #d69e2e;
    color: #fff;
}

.section-title {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.section-title.used {
    background: linear-gradient(135deg, #d69e2e, #b7791f);
    color: white;
}

/* ==========================================
   4. بطاقات المنتجات (Products)
   ========================================== */
.product-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #e2e8f0;
    position: relative;
}

.product-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.product-card h3 {
    color: #2d3748;
    font-size: 1.25rem;
    margin: 15px 0 10px 0;
    font-weight: 600;
}

.price {
    color: #38a169;
    font-weight: 700;
    font-size: 1.2em;
    margin-bottom: 15px;
    background: #f0fff4;
    padding: 6px;
    border-radius: 6px;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================
   5. السلايدر (معرض الصور)
   ========================================== */
.slider-container {
    position: relative;
    width: 100%;
    height: 180px;
    background-color: #f7fafc;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid #edf2f7;
}

.slider-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    padding: 8px;
    box-sizing: border-box;
}

.slider-container img.active {
    display: block;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 50%;
    font-size: 14px;
    z-index: 10;
    transition: background 0.2s;
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.prev-btn { right: 8px; }
.next-btn { left: 8px; }

/* ==========================================
   6. أزرار البطاقات والروابط
   ========================================== */
.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-buy {
    flex: 1;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: white;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s ease, opacity 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-buy:hover {
    background: linear-gradient(135deg, #2b6cb0, #2c5282);
    opacity: 0.95;
}

.btn-details {
    flex: 1;
    background: #00b4d8;
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-details:hover {
    background: #0096c7;
}

.back-link {
    display: inline-block;
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    margin-top: 15px;
    font-weight: bold;
    transition: background 0.2s;
}

.back-link:hover {
    background: #5a6268;
}

/* ==========================================
   7. صفحة تفاصيل المنتج (Details Page)
   ========================================== */
.details-container {
    max-width: 800px;
    margin: 40px auto;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.details-slider {
    position: relative;
    width: 100%;
    height: 350px;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.details-slider img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    padding: 10px;
    box-sizing: border-box;
}

.details-slider img.active {
    display: block;
}

.product-title {
    font-size: 26px;
    color: #2d3748;
    margin-bottom: 10px;
    font-weight: 700;
}

.product-price {
    font-size: 22px;
    color: #38a169;
    font-weight: bold;
    margin-bottom: 15px;
}

.product-desc {
    font-size: 16px;
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-line;
}

.details-container .btn-buy {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: white;
    padding: 12px 15px;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: background 0.2s ease, opacity 0.2s ease;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    margin-top: 15px;
}

.details-container .btn-buy:hover {
    background: linear-gradient(135deg, #2b6cb0, #2c5282);
    opacity: 0.95;
}

.details-container .back-link {
    display: block;
    text-align: center;
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 10px;
    font-weight: bold;
    transition: background 0.2s;
}

.details-container .back-link:hover {
    background: #5a6268;
}

/* ==========================================
   8. قسم آراء العملاء (Reviews Section)
   ========================================== */
.reviews-section {
    grid-column: 1 / -1;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 40px;
    border: 1px solid #e0e0e0;
}

.reviews-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    align-items: flex-start; /* حل مشكلة تمدد البطاقات القصيرة وتثبيتها في الأعلى */
}

.review-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    border: 1px solid #cbd5e1;
    border-right: 5px solid #007bff;
    position: relative;
    display: flex;
    flex-direction: column;
    height: auto; /* الحفاظ على طول المحتوى الفعلي لكل بطاقة فقط */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.review-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.review-card.pending-badge::after {
    content: 'قيد المراجعة (مرئي لك فقط)';
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ffc107;
    color: #333;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.review-author {
    font-weight: bold;
    color: #2c3e50;
    font-size: 16px;
    margin-bottom: 6px;
}

.review-stars {
    color: #ffc107;
    font-size: 14px;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.review-text {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.6;
}

.review-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.review-form input, 
.review-form textarea, 
.review-form select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.review-form button {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
}

.review-form button:hover {
    background: #218838;
}

/* ==========================================
   9. لوحة التحكم (Admin Panel)
   ========================================== */
.admin-nav {
    text-align: center;
    background: #343a40;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 4px;
    background: #495057;
    transition: 0.3s;
    display: inline-block;
}

.admin-nav a:hover, 
.admin-nav a.active {
    background: #007bff;
}

.admin-form {
    width: 100%;
    max-width: 600px;
    background: white;
    margin: 20px auto;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.admin-form input, 
.admin-form textarea, 
.admin-form select {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.admin-form button {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    font-weight: bold;
}

.admin-form button:hover {
    background: #218838;
}

/* الجداول في لوحة التحكم */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    margin-bottom: 30px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

th, td {
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: right;
    vertical-align: middle;
}

th {
    background-color: #007bff;
    color: white;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

.btn {
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    display: inline-block;
    margin-left: 5px;
    cursor: pointer;
    border: none;
}

.btn-approve {
    background-color: #28a745;
    color: white;
}

.btn-approve:hover {
    background-color: #218838;
}

.btn-reject {
    background-color: #dc3545;
    color: white;
}

.btn-reject:hover {
    background-color: #c82333;
}

.alert {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-weight: bold;
}

.alert.success, .success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    text-align: center;
}

.alert.danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.no-data {
    text-align: center;
    color: #777;
    padding: 20px;
}