body { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; margin: 0; background-color: #f2f4f8; color: #333; }
header { background-color: #131921; color: white; padding: 15px 5%; display: flex; justify-content: space-between; align-items: center; }
header h1 { margin: 0; color: #febd69; font-size: 24px; }
nav { background-color: #232f3e; padding: 10px 5%; display: flex; gap: 15px; align-items: center; overflow-x: auto; }
nav a { color: white; text-decoration: none; font-weight: bold; padding: 8px 12px; border-radius: 4px; cursor: pointer; transition: 0.3s; white-space: nowrap;}
nav a.active, nav a:hover { background-color: #febd69; color: #111; }

/* 🕵️‍♂️ كود إخفاء زر الإدارة السري */
.secret-admin, .secret-admin:hover, .secret-admin.active { 
    color: transparent !important; 
    background-color: transparent !important; 
    user-select: none; 
    cursor: pointer;
}

.container { padding: 20px 5%; max-width: 1200px; margin: auto; }
.page { display: none; }
.page.active { display: block; }

/* البحث والفلاتر */
.search-container { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; background: white; padding: 15px; border-radius: 8px; border: 1px solid #ddd; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.search-box { padding: 10px; border: 2px solid #febd69; border-radius: 6px; font-family: inherit; font-size: 14px; box-sizing: border-box; flex: 1; min-width: 140px; }
.search-box:focus { outline: none; border-color: #2196F3; }
.cat-filter-bar { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 10px;}
.cat-btn { background: white; border: 1px solid #ddd; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-weight: bold; white-space: nowrap; color: #555; }
.cat-btn.active-cat { background: #2196F3; color: white; border-color: #2196F3; }
.subcat-filter-bar { display: none; gap: 8px; overflow-x: auto; padding: 10px; background: #e7f3fe; border-radius: 8px; border: 1px dashed #2196F3; }
.subcat-filter-bar.active { display: flex; }
.sub-btn { background: white; border: 1px solid #2196F3; padding: 5px 12px; border-radius: 15px; cursor: pointer; font-size: 13px; color: #2196F3; white-space: nowrap;}
.sub-btn.active-sub { background: #2196F3; color: white; }

/* شبكة الإعلانات والكروت */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }
.card { background: white; padding: 12px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative; display: flex; flex-direction: column; }
.card.pinned { border: 2px solid #e91e63; background: #fffcfd; }

@media (min-width: 768px) {
    .card.span-2 { grid-column: span 2; } .card.span-3 { grid-column: span 3; } .card.span-4 { grid-column: span 4; } .card.span-5 { grid-column: span 5; }
    .card.span-2 .image-gallery img { width: 100px; height: 100px; }
    .card.span-3 .image-gallery img, .card.span-4 .image-gallery img, .card.span-5 .image-gallery img { width: 140px; height: 140px; }
    .card.span-3 h3, .card.span-4 h3, .card.span-5 h3 { font-size: 20px; }
}

.image-gallery { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 5px; }
.image-gallery img { width: 70px; height: 70px; object-fit: cover; border-radius: 4px; border: 1px solid #eee; flex-shrink: 0; }
.card h3 { margin: 0 0 8px; font-size: 15px; color: #111;}
.card p.desc { color: #555; font-size: 12px; margin-bottom: 10px; line-height: 1.5; flex-grow: 1; }
.stats-bar { display: flex; justify-content: space-between; font-size: 11px; color: #555; background: #f0f0f0; padding: 6px; border-radius: 4px; margin-bottom: 10px; border: 1px solid #e0e0e0; }
.stats-bar strong { color: #111; font-size: 12px; }
.category-tags { display: flex; gap: 5px; margin-bottom: 8px; flex-wrap: wrap;}
.category-tag { background: #e7f3fe; color: #2196F3; padding: 2px 6px; border-radius: 12px; font-size: 10px; }
.subcategory-tag { background: #f0f0f0; color: #666; padding: 2px 6px; border-radius: 12px; font-size: 10px; border: 1px solid #ddd;}
.status-badge { position: absolute; top: 10px; left: 10px; font-size: 10px; padding: 3px 6px; border-radius: 4px; font-weight: bold; background: #ff9800; color: white;}
.status-featured { position: absolute; top: 10px; right: 10px; background: #e91e63; color: white; font-size: 10px; padding: 3px 6px; border-radius: 4px; font-weight: bold; z-index: 2; }

/* الأزرار والنماذج */
.btn { background: #febd69; color: #111; border: none; padding: 6px 10px; cursor: pointer; font-weight: bold; border-radius: 4px; font-size: 12px; }
.btn-success { background: #4CAF50; color: white; }
.btn-danger { background: #f44336; color: white; }
.btn-info { background: #2196F3; color: white; }
.btn-feature { background: #9c27b0; color: white; }
.btn-enlarge { background: #009688; color: white; } 
.btn-purchase { background: #ff9800; color: white; } 
.btn-view { background: #131921; color: white; width: 100%; margin-top: 8px; padding: 8px; font-size: 12px;}
.btn-gemini { background: #673ab7; color: white; width: 100%; margin-top: 10px; padding: 10px;}
.btn-whatsapp { background: #25D366; color: white; display: block; text-align: center; text-decoration: none; padding: 8px; margin-top: 8px; border-radius: 4px; font-weight: bold; font-size: 14px;}

.form-container { background: white; padding: 25px; border-radius: 8px; max-width: 650px; margin: auto; box-shadow: 0 2px 10px rgba(0,0,0,0.1);}
.form-container form h2 { margin-top: 0; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
.admin-section { background: white; padding: 20px; border-radius: 8px; margin-bottom: 25px; border-right: 5px solid #2196F3; box-shadow: 0 2px 5px rgba(0,0,0,0.05);}
.admin-controls { margin-top: 10px; display: flex; gap: 5px; flex-wrap: wrap; }
.admin-controls .btn { flex: 1; min-width: 50px; }

/* النافذة المنبثقة */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); overflow-y: auto;}
.modal-content { background: #fff; margin: 5% auto; padding: 20px; border-radius: 8px; width: 90%; max-width: 700px; position: relative; }
.close-modal { color: #aaa; position: absolute; left: 20px; top: 10px; font-size: 28px; font-weight: bold; cursor: pointer; }
.modal-images { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; justify-content: center;}
.modal-images img { max-width: 100%; height: auto; max-height: 300px; border-radius: 8px; object-fit: contain; }
.alert { padding: 15px; margin-bottom: 20px; border-radius: 4px; font-weight: bold; display: none; background: #dff0d8; color: #3c763d; border: 1px solid #d6e9c6; }

/* --- تعديلات الموبايل (إظهار إعلانين بجوار بعضهما) --- */
@media (max-width: 600px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .container {
        padding: 10px 3%;
    }

    .card {
        padding: 8px;
    }

    .card h3 {
        font-size: 12px;
        margin-bottom: 5px;
    }

    .image-gallery img {
        width: 50px;
        height: 50px;
    }

    .stats-bar {
        flex-direction: column; 
        align-items: center;
        gap: 3px;
        font-size: 10px;
        padding: 4px;
    }

    .card p.desc {
        font-size: 10px;
        margin-bottom: 5px;
    }

    .category-tag, .subcategory-tag {
        font-size: 8px;
        padding: 2px 4px;
    }

    .btn-view {
        font-size: 10px;
        padding: 6px;
    }
    
    .status-badge, .status-featured {
        font-size: 8px;
        padding: 2px 4px;
    }
    
    .contact-info {
        font-size: 10px;
    }
}