:root {
    --primary-color: #ff0000; /* Crimson Red */
    --dark-color: #000000;
    --light-gray-color: #F5F5F5;
    --glass-bg: rgba(0, 0, 0, 0.3);
    --glass-blur: 10px;
    --border-color: rgba(255, 255, 255, 0.2);
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--dark-color);
    color: var(--light-gray-color);
    background-image: url('https://www.transparenttextures.com/patterns/dark-denim-3.png');
    padding-top: 80px; /* Add padding to prevent navbar overlap */
}

/* Ensure containers have proper spacing */
.container, .container-fluid {
    position: relative;
    z-index: 1;
}

/* Fix for pages without hero section */
.container.mt-5, .container.my-5 {
    margin-top: 2rem !important;
}

/* Fix for pages with pt-5 class */
.container.pt-5, main.pt-5 {
    padding-top: 1rem !important;
}

/* Fix sticky elements positioning */
.sticky-top {
    top: 90px !important; /* Adjust for navbar height */
}

/* --- Navbar --- */
.navbar {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease-in-out;
}

.navbar .navbar-brand {
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.navbar .nav-link {
    color: white;
    font-weight: 400;
    transition: color 0.3s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--primary-color);
}

.btn-danger {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-danger:hover {
    background-color: #b01030;
    border-color: #b01030;
}

.btn-outline-danger {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-danger:hover {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}


/* --- Hero Carousel --- */
.hero-section {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dark-color) 0%, #1a1a1a 100%);
    position: relative;
    overflow: hidden;
    margin-top: -80px; /* Compensate for body padding-top */
    padding-top: 80px; /* Add padding to prevent navbar overlap */
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://www.transparenttextures.com/patterns/dark-denim-3.png');
    opacity: 0.3;
    z-index: 1;
}

.hero-section .carousel-item {
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

.hero-content {
    padding: 2rem;
    z-index: 3;
    position: relative;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #cccccc;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-image {
    padding: 2rem;
    position: relative;
    z-index: 3;
}

.hero-image img {
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.hero-image img:hover {
    transform: scale(1.02);
}

.hero-buttons .btn {
    padding: 12px 30px;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Large screens (desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
}

/* Medium screens (tablets, 768px and up) */
@media (max-width: 991.98px) {
    body {
        padding-top: 70px; /* Reduce padding for smaller screens */
    }
    
    .hero-section {
        margin-top: -70px; /* Adjust for reduced padding */
        padding-top: 70px;
    }
    
    .sticky-top {
        top: 80px !important; /* Adjust for smaller navbar */
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-content {
        text-align: center;
        padding: 1rem;
    }
    
    .hero-image {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    .navbar-brand .logo {
        max-height: 60px;
    }
    
    .navbar-brand .brand-text {
        font-size: 1.2rem;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .car-card .card-img-top,
    .offer-card .card-img-top {
        height: 200px;
    }
}

/* Small screens (landscape phones, 576px and up) */
@media (max-width: 767.98px) {
    body {
        padding-top: 60px; /* Further reduce padding for mobile */
    }
    
    .hero-section {
        margin-top: -60px; /* Adjust for mobile padding */
        padding-top: 60px;
    }
    
    .sticky-top {
        top: 70px !important; /* Adjust for mobile navbar */
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-content {
        padding: 0.5rem;
    }
    
    .hero-buttons .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    .navbar-brand .logo {
        max-height: 50px;
    }
    
    .navbar-brand .brand-text {
        font-size: 1rem;
    }
    
    .glass-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .car-card .card-img-top,
    .offer-card .card-img-top {
        height: 180px;
    }
    
    .video-card .card-body {
        padding: 1rem;
    }
    
    /* Chat modal responsive */
    .chat-modal {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        height: 450px;
    }
    
    .chat-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 15px;
        right: 15px;
    }
}

/* Extra small screens (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .hero-section {
        min-height: 80vh;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .navbar-brand .logo {
        max-height: 40px;
    }
    
    .navbar-brand .brand-text {
        font-size: 0.9rem;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
    }
    
    .glass-card {
        padding: 0.75rem;
        border-radius: 10px;
    }
    
    .car-card,
    .offer-card,
    .video-card {
        border-radius: 10px;
    }
    
    .car-card .card-img-top,
    .offer-card .card-img-top {
        height: 160px;
        border-radius: 10px 10px 0 0;
    }
    
    .video-card .video-container,
    .video-card iframe,
    .video-card video {
        border-radius: 10px 10px 0 0;
    }
    
    /* Table responsive */
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Chat modal for very small screens */
    .chat-modal {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        height: 400px;
        bottom: 70px;
    }
    
    .chat-button {
        width: 45px;
        height: 45px;
        font-size: 18px;
        bottom: 10px;
        right: 10px;
    }
    
    .quick-btn {
        min-width: 100px;
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    /* News page responsive */
    .news-card .card-img-top {
        height: 150px;
    }
    
    .news-card .card-title {
        font-size: 1rem;
    }
    
    .news-card .card-text {
        font-size: 0.85rem;
    }
}

/* ===== ADDITIONAL RESPONSIVE UTILITIES ===== */

/* Touch-friendly buttons */
@media (max-width: 767.98px) {
    .btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
}

/* Improved text readability on small screens */
@media (max-width: 575.98px) {
    body {
        font-size: 14px;
        line-height: 1.6;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .hero-buttons .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .chat-button,
    .chat-modal,
    .hero-buttons,
    .btn {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        page-break-after: always;
    }
    
    .glass-card {
        background: white !important;
        color: black !important;
        border: 1px solid #ddd !important;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Optimize animations for better performance */
/*
* {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
*/

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-card {
        background: rgba(0, 0, 0, 0.9) !important;
        border: 2px solid white !important;
    }
    
    .text-muted {
        color: #ccc !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Already dark by default, but ensure consistency */
    body {
        background-color: #000;
        color: #f5f5f5;
    }
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}




/* --- Glassmorphism Card --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 15px;
    border: 1px solid var(--border-color);
    padding: 2rem;
    transition: all 0.3s ease;
}

#services .glass-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#services .glass-card:hover {
    transform: translateY(-10px);
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--primary-color);
}

/* --- Car Page Specifics --- */
.car-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.car-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.car-card .card-img-top {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    object-fit: cover;
    height: 220px;
}

.car-card .card-price {
    color: var(--primary-color);
    font-weight: bold;
}

.car-card .card-title {
    color: var(--light-gray-color);
    font-weight: 600;
}

.car-card .card-text {
    color: var(--light-gray-color);
}

.form-select, .form-control {
    background-color: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    color: white;
}

.form-select:focus, .form-control:focus {
    background-color: rgba(255,255,255,0.2);
    border-color: var(--primary-color);
    color: white;
    box-shadow: none;
}

.form-select option {
    background: #333;
    color: white;
}

/* --- Car Details Page --- */
.car-specs .list-group-item {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--light-gray-color);
    padding-left: 0;
    padding-right: 0;
}

/* --- Offer Card Specifics --- */
.offer-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.offer-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.offer-card .card-img-top {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    object-fit: cover;
    height: 180px;
}

.offer-card .card-price {
    color: var(--primary-color);
    font-weight: bold;
}

.offer-card .card-title {
    color: var(--light-gray-color);
    font-weight: 600;
}

.offer-card .card-text {
    color: var(--light-gray-color);
}

/* --- Floating Chat Button --- */
.chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.chat-button:hover {
    transform: scale(1.1);
    color: white;
}

/* --- General --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

/* --- Card Text Styles --- */
.card-title {
    color: var(--light-gray-color) !important;
}

.card-text {
    color: var(--light-gray-color) !important;
}

.card-body {
    color: var(--light-gray-color);
}

.text-danger {
    color: var(--primary-color) !important;
}

footer.text-muted {
    color: #a0a0a0 !important;
}

footer a.text-reset {
    transition: color 0.3s;
}

footer a.text-reset:hover {
    color: var(--primary-color) !important;
}

/* --- Video Card Specifics --- */
.video-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.video-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 20px rgba(249, 248, 248, 0.4);
}

.video-card .video-container {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    overflow: hidden;
}

.video-card iframe,
.video-card video {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.video-card .card-body {
    padding: 1.5rem;
}

.video-card .card-title {
    color: var(--light-gray-color);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.video-card .card-text {
    color: var(--light-gray-color);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* --- Logo Styles --- */
.navbar-brand .logo {
    max-height: 80px;
    width: auto;
    transition: transform 0.3s ease;
}

.navbar-brand:hover .logo {
    transform: scale(1.05);
}

.navbar-brand .brand-text {
    font-weight: 900;
    font-size: 1.5rem;
    text-decoration: none;
}

.navbar-brand:hover {
    text-decoration: none;
}

/* --- Chat Bot Styles --- */
.chat-modal {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.chat-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.btn-close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.btn-close-chat:hover {
    background: rgba(255,255,255,0.2);
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 300px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.bot-message, .user-message {
    margin-bottom: 15px;
    display: flex;
}

.bot-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.bot-message .message-content {
    background: rgba(255,255,255,0.1);
    color: white;
    border-bottom-left-radius: 5px;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.chat-link {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
}

.chat-link:hover {
    color: #ffed4e;
    text-decoration: underline;
}

.quick-options {
    padding: 10px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.quick-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.quick-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.chat-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 15px;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-container input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255,255,255,0.2);
}

.chat-input-container input::placeholder {
    color: rgba(255,255,255,0.6);
}

.send-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: #b01030;
    transform: scale(1.1);
}

/* City selection buttons */
.city-btn {
    margin: 2px !important;
    padding: 5px 10px !important;
    background: #007bff !important;
    color: white !important;
    border: none !important;
    border-radius: 15px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
}

.city-btn:hover {
    background: var(--primary-color) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
}

/* --- Car Comparison Styles --- */
.compare-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.compare-table {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 15px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.compare-table .table {
    margin-bottom: 0;
    color: var(--light-gray-color);
}

.compare-table .table th,
.compare-table .table td {
    border-color: rgba(255, 255, 255, 0.1);
    vertical-align: middle;
    padding: 1rem;
}

.compare-table .table thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    border: none;
}

.compare-table .sticky-column {
    position: sticky;
    left: 0;
    background: rgba(0, 0, 0, 0.8) !important;
    z-index: 10;
    border-right: 2px solid var(--primary-color);
    font-weight: 600;
}

.compare-empty-state {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 15px;
    border: 1px solid var(--border-color);
    padding: 3rem;
    text-align: center;
}

.compare-empty-state i {
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 1rem;
}

.compare-car-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.compare-remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.8);
    border: none;
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.compare-remove-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.compare-actions .btn {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Responsive chat */
@media (max-width: 768px) {
    .chat-modal {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        height: 400px;
    }
    
    .city-btn {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    
    .compare-table .sticky-column {
        min-width: 150px;
        font-size: 0.875rem;
    }
    
    .compare-table .table th,
    .compare-table .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .compare-car-image {
        height: 80px;
    }
}
