/**
 * Truckways Theme Stylesheet
 * Modern, responsive design for second-hand truck sales
 * Colors: Red, Black, White, Grey
 * Features: Dark/Light theme toggle
 */

/* ===================================
   CSS Variables for Theme Switching
   =================================== */

:root {
    /* Light Theme Colors */
    --primary-color: #DC2626;
    --primary-hover: #B91C1C;
    --secondary-color: #1F2937;
    --accent-color: #EF4444;
    
    --bg-primary: #FFFFFF;
    --bg-secondary: #F3F4F6;
    --bg-tertiary: #E5E7EB;
    
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6B7280;
    
    --border-color: #D1D5DB;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    
    --header-bg: #1F2937;
    --header-text: #FFFFFF;
    --footer-bg: #111827;
    --footer-text: #F3F4F6;
    
    /* Spacing */
    --container-max: 1200px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    /* Dark Theme Colors */
    --primary-color: #EF4444;
    --primary-hover: #DC2626;
    --secondary-color: #F3F4F6;
    --accent-color: #F87171;
    
    --bg-primary: #111827;
    --bg-secondary: #1F2937;
    --bg-tertiary: #374151;
    
    --text-primary: #F9FAFB;
    --text-secondary: #E5E7EB;
    --text-muted: #9CA3AF;
    
    --border-color: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    
    --header-bg: #000000;
    --header-text: #FFFFFF;
    --footer-bg: #000000;
    --footer-text: #E5E7EB;
}

/* ===================================
   Global Styles
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    max-width: 100%;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

table {
    max-width: 100%;
    overflow-x: auto;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition);
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* ===================================
   Typography
   =================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

/* ===================================
   Container & Layout
   =================================== */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    box-sizing: border-box;
}

.container-fluid {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Full width hero section */
.hero .container-fluid {
    padding: 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* Full width CTA section */
.section .container-fluid {
    padding: 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* Ensure hero section breaks out of any container constraints */
.hero {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    position: relative;
}

/* Ensure CTA section breaks out of any container constraints */
.section[style*="background: linear-gradient"] {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    position: relative;
}

/* Full width features section */
.section.features {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    position: relative;
}

/* Full width featured trucks section */
.section.featured-trucks-section {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    position: relative;
}

.featured-trucks-widget {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    position: relative;
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
}

.section {
    padding: var(--spacing-lg) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    margin: var(--spacing-sm) auto 0;
    border-radius: var(--radius-sm);
}

/* ===================================
   Header & Navigation
   =================================== */

.site-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}


.header-main {
    padding: var(--spacing-sm) 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.site-logo img {
    height: 78px;
    width: auto;
    transition: transform 0.3s ease;
}

.site-logo:hover img {
    transform: scale(1.05);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: var(--spacing-md);
    margin: 0;
}

.main-nav a {
    color: var(--header-text);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    background-color: var(--primary-color);
    color: white;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    color: var(--header-text);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.theme-icon {
    font-size: 1.2rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ===================================
   Main Content Area
   =================================== */

.site-main {
    margin: 0;
    padding: 0;
}

/* ===================================
   Hero Section
   =================================== */

.hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    padding: var(--spacing-lg) 0;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
    max-width: 100%;
    overflow: hidden;
}

.hero-text h1 {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.hero-text .highlight {
    color: var(--primary-color);
}

.hero-text p {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-lg);
    color: var(--text-secondary);
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.hero-image {
    position: relative;
}

.hero-image img {
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px var(--shadow-lg);
}

/* ===================================
   Buttons
   =================================== */

.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white !important;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--shadow);
}

/* Hero buttons with inline white background - ensure visible text on hover */
.hero-buttons .btn:hover,
.hero .btn:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: white !important;
}

/* Custom homepage button classes from database content */
.btn-browse {
    background: var(--primary-color);
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-browse:hover {
    background: var(--primary-hover) !important;
    color: white !important;
    transform: translateY(-2px);
}

.btn-whatsapp {
    background: #6b7280;
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-whatsapp:hover {
    background: #25D366 !important;
    color: white !important;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

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

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

.btn-whatsapp {
    background-color: #25D366 !important;
    border-color: #25D366 !important;
    color: white !important;
}

.btn-whatsapp:hover {
    background-color: #128C7E !important;
    border-color: #128C7E !important;
    color: white !important;
}

/* ===================================
   Cards & Products
   =================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-lg);
}

.card-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.card:hover .card-image img {
    transform: scale(1.1);
}

.card-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

.card-content {
    padding: var(--spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.card-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
    flex-grow: 1;
    min-height: 3.6rem;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.card-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.card-footer {
    padding: var(--spacing-md);
    padding-top: 0;
    margin-top: auto;
}

/* ===================================
   Features Section
   =================================== */

.features {
    background-color: var(--bg-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    max-width: 100%;
    overflow: hidden;
}

.feature-item {
    text-align: center;
    padding: var(--spacing-lg);
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow);
}

.feature-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.feature-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
}

.feature-description {
    color: var(--text-muted);
}

/* ===================================
   Footer
   =================================== */

.site-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: var(--spacing-xl) 0 var(--spacing-md);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-section h3 {
    color: var(--footer-text);
    margin-bottom: var(--spacing-md);
    font-size: 1.25rem;
}

.footer-section p,
.footer-section li {
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: var(--text-muted);
    display: block;
    padding: 0.25rem 0;
}

.footer-section a:not(.social-link):hover {
    color: var(--primary-color);
    padding-left: 0.5rem;
}

.social-links {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    justify-content: center;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--text-primary);
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}

.social-link i {
    font-size: 18px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
}

.social-link:hover {
    background-color: var(--primary-color);
    color: white !important;
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.3);
}

.social-link:hover i {
    color: white !important;
    transform: translate(-50%, -50%) scale(1.1);
}

.footer-bottom {
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.footer-theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-size: 0.875rem;
}

.footer-theme-toggle:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.footer-theme-toggle .theme-text {
    font-weight: 500;
}

/* Header theme toggle - visible on desktop/tablet */
.header-theme-toggle {
    display: flex;
}

/* Footer theme toggle - hidden by default, shown on mobile */
.footer-theme-toggle {
    display: none;
}

/* Featured trucks shortcode responsive grid */
.featured-trucks-shortcode {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
}

.featured-trucks-widget-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .main-nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--header-bg);
        flex-direction: column;
        padding: var(--spacing-md);
        box-shadow: 0 10px 20px var(--shadow);
    }
    
    .main-nav ul.active {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-text p {
        font-size: 1rem;
    }
    
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: var(--spacing-md);
    }
    
    .featured-trucks-shortcode {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    }
    
    .featured-trucks-widget-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--spacing-sm);
    }
    
    .featured-trucks-shortcode {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    }
    
    .featured-trucks-widget-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    }
}

@media (max-width: 480px) {
    .hero-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .featured-trucks-shortcode {
        grid-template-columns: 1fr !important;
    }
    
    .featured-trucks-widget-grid {
        grid-template-columns: 1fr !important;
    }
    
    .card {
        margin: 0 auto;
        max-width: 100%;
    }
    
    .card-content {
        padding: var(--spacing-sm);
    }
    
    .card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .card-meta span {
        font-size: 0.8rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-price {
        font-size: 1.3rem;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }
    
    .footer-theme-toggle {
        align-self: center;
        display: flex; /* Show footer theme toggle on mobile */
    }
    
    .header-theme-toggle {
        display: none; /* Hide header theme toggle on mobile */
    }
}

/* ===================================
   Utility Classes
   =================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }

.hidden { display: none; }
.visible { display: block; }
