/* ===================================
   المتغيرات العامة والخلفية
   =================================== */
:root {
    --primary: #1a1a1a;
    --primary-dark: #0f0f0f;
    --secondary: #ff7a00;
    --secondary-light: #ffa142;
    --gradient: linear-gradient(135deg, var(--primary) 0%, #2a5298 100%);
    --glass: rgba(255, 255, 255, 0.95);
    --shadow: 0 25px 40px -12px rgba(0, 0, 0, 0.2);
    --radius: 28px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-image: url('car.jpg') !important;
    background-size: 100% auto !important;
    background-position: center 20% !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    background-color: #0f172a !important;
    color: #ffffff;
    line-height: 1.5;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===================================
   Navbar (شريط التنقل)
   =================================== */
.navbar {
    background: var(--gradient);
    color: white;
    padding: 0.8rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.logo i {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* العنوان الرئيسي - لون ذهبي متدرج */
.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(120deg, #ffd966, #ff8c42);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-left: 5px;
}

.logo span {
    font-weight: 400;
    background: var(--secondary);
    padding: 2px 8px;
    border-radius: 40px;
    font-size: 0.7rem;
    color: #ffffff;
}

.logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
    animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.nav-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-glow,
.btn-outline-light {
    padding: 8px 18px;
    border-radius: 40px;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-glow {
    background: var(--secondary);
    color: #1e2a3a;
    box-shadow: 0 4px 12px rgba(255, 140, 66, 0.4);
}

.btn-glow:hover {
    transform: translateY(-2px);
    background: var(--secondary-light);
    box-shadow: 0 8px 20px rgba(255, 140, 66, 0.5);
}

.btn-outline-light {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-outline-light:hover {
    background: white;
    color: var(--primary);
}

/* ===================================
   Hero Section - شفاف بالكامل
   =================================== */
.hero {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 60px 0 40px;
    text-align: center;
    border-bottom-left-radius: 48px;
    border-bottom-right-radius: 48px;
    margin-bottom: 20px;
}

.hero-content h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: #ffffff !important;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.hero-content h2 span {
    color: var(--secondary);
}

.hero-content p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9) !important;
    max-width: 600px;
    margin: 0 auto 30px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.hero-stats div {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    padding: 8px 20px;
    border-radius: 60px;
    font-weight: 600;
    color: white !important;
    border: 1px solid rgba(255,255,255,0.2);
}

.hero-stats i {
    color: var(--secondary);
    margin-left: 8px;
}

.btn-hero {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-hero:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

/* ===================================
   البحث والفلترة
   =================================== */
.search-filters {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 48px;
    padding: 15px 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.search-bar {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border-radius: 60px;
    padding: 5px 20px;
    margin-bottom: 15px;
}

.search-bar i {
    color: #ffffff;
    font-size: 1.2rem;
}

.search-bar input {
    flex: 1;
    padding: 12px 12px;
    border: none;
    background: transparent;
    font-size: 1rem;
    outline: none;
    color: #ffffff;
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.filter-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 0;
    color: #ffffff;
    font-weight: 600;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.filter-panel {
    display: none;
    margin-top: 20px;
}

.filter-panel.show {
    display: block;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.filter-input {
    padding: 10px 14px;
    border-radius: 40px;
    border: 1px solid #ddd;
    background: white;
    color: #1a2a3a;
}

.btn-filter,
.btn-reset {
    padding: 10px;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-filter {
    background: var(--primary);
    color: white;
}

.btn-reset {
    background: #e9ecef;
    color: #2c3e50;
}

/* ===================================
   أزرار فلترة حالة البيع (جديد)
   =================================== */
.sold-filter-group {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 10px;
    margin-top: 5px;
}
.filter-label {
    font-weight: bold;
    color: #ffffff;
}
.sold-filter-btn {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.85rem;
}
.sold-filter-btn.active {
    background: #ff8c42;
    color: #1e2a3a;
}
.sold-filter-btn:hover {
    background: #ff8c42;
    color: #1e2a3a;
}

/* ===================================
   شارة مباعة على الصورة (جديد)
   =================================== */
.sold-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #e74c3c;
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ===================================
   بطاقات السيارات
   =================================== */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.car-card {
    background: rgba(0,0,0,0.6);
    border-radius: 32px;
    overflow: hidden;
    transition: 0.3s ease;
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.car-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 35px -12px rgba(0, 0, 0, 0.2);
}

.car-image {
    height: 200px;
    background: #d9e2ec;
    position: relative;
    overflow: hidden;
}

.car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.car-card:hover .car-image img {
    transform: scale(1.05);
}

.featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--secondary);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: bold;
    color: #1e2a3a;
}

.image-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
}

.car-info {
    padding: 18px;
}

.car-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #ffffff;
}

.car-price {
    color: var(--secondary);
    font-size: 1.3rem;
    font-weight: 800;
    margin: 8px 0;
}

.car-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.75rem;
    color: #ffffff;
    border-top: 1px solid #ecf0f1;
    padding-top: 10px;
    margin: 8px 0;
}

.car-details i {
    width: 18px;
}

.car-location {
    background: #eef3fc;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    color: #2c5a7a;
    margin: 5px 0;
}

.owner-name {
    font-size: 0.7rem;
    color: #ffffff;
    margin: 8px 0 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.delete-car,
.upgrade-btn {
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    border: none;
}

.delete-car {
    background: #e74c3c;
    color: white;
}

.upgrade-btn {
    background: var(--secondary-light);
    color: white;
}

.call-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #28a745;
    color: white !important;
    text-decoration: none !important;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 40px;
    margin: 10px auto 0;
    transition: all 0.3s ease;
    text-align: center;
    cursor: pointer;
    width: fit-content;
}

.call-btn:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

/* ===================================
   Pagination
   =================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    border-radius: 30px;
    border: 1px solid #cfdfed;
    background: white;
    cursor: pointer;
    font-weight: 600;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===================================
   Modal
   =================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: white;
    max-width: 650px;
    margin: 40px auto;
    border-radius: 48px;
    padding: 28px;
    position: relative;
}

.auth-modal {
    max-width: 480px;
}

.glass {
    background: rgba(255, 255, 255, 0.98);
}

.close {
    position: absolute;
    left: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    margin-bottom: 15px;
}

.form-group label {
    color: #1a2a3a;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 30px;
    border: 1px solid #cfdfed;
    background: white;
    color: #1a2a3a;
}

.btn-submit {
    background: var(--gradient);
    color: white;
    width: 100%;
    padding: 12px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    border: none;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.preview-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #ddd;
}

/* حالة التحميل */
.loading {
    text-align: center;
    padding: 60px;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* توست */
.toast {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 12px 20px;
    border-radius: 40px;
    color: white;
    font-weight: bold;
    z-index: 9999;
    direction: rtl;
}

.toast-success { background: #27ae60; }
.toast-error { background: #e74c3c; }
.toast-info { background: #3498db; }

/* Footer */
.footer {
    background: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 60px;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-content h2 {
        font-size: 1.6rem;
    }
    .hero-stats {
        gap: 15px;
    }
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }
    .cars-grid {
        grid-template-columns: 1fr;
    }
    .logo h1 {
        font-size: 1.2rem;
    }
    .logo-img {
        height: 35px;
    }
    .nav-actions {
        justify-content: center;
        width: 100%;
    }
}

/* ===================================
   Lightbox (إضافة عرض الصور)
   =================================== */
.lightbox {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 80%;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10001;
}
.lightbox-close:hover {
    color: #ff8c42;
}
.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 12px 18px;
    cursor: pointer;
    border-radius: 50%;
    transition: 0.2s;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-prev:hover, .lightbox-next:hover {
    background: #ff8c42;
    color: #1e2a3a;
}
.lightbox-counter {
    margin-top: 20px;
    color: white;
    background: rgba(0,0,0,0.6);
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.9rem;
}
@media (max-width: 768px) {
    .lightbox-prev, .lightbox-next {
        font-size: 1.2rem;
        padding: 8px 12px;
    }
    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}

/* زر تبديل حالة البيع للمالك */
.toggle-sold-btn {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 40px;
    font-size: 0.8rem;
    margin-top: 8px;
    width: 100%;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 600;
}
.toggle-sold-btn:hover {
    background: #ff8c42;
    color: #1e2a3a;
}
