/* ============================================
   CSS VARIABLES - EASY COLOR CUSTOMIZATION
   ============================================ */
:root {
    --primary-color: #000000;
    --primary-hover: #c50919;
    --text-dark: #1A1A1A;
    --text-gray: #4A4A4A;
    --text-light: #6B6B6B;
    --bg-white: #FFFFFF;
    --bg-light: #F5F5F5;
    --bg-lighter: #FAFAFA;
    --bg-dark: #1A1A1A;
    --border-color: #E0E0E0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ============================================
   CRITICAL CSS - ABOVE THE FOLD
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

h1 {
    font-size: clamp(1.75rem, 5vw, 2.8rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

p {
    margin-bottom: 1rem;
    color: var(--text-gray);
    line-height: 1.7;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   HEADER - IMPROVED LAYOUT WITH LOGO
   ============================================ */
.header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    align-items: center;
    padding: 15px 0;
    gap: 20px;
}

/* Logo on the left */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo-image {
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

/* Contact info in the center */
.contact-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
}

.phone {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-dark);
    letter-spacing: 0.5px;
}

.phone:hover {
    color: var(--primary-color);
}

.hours {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Empty space on the right for balance */
.header-spacer {
    display: flex;
    justify-content: flex-end;
}

/* ============================================
   HERO SECTION WITH BACKGROUND IMAGE
   ============================================ */
.hero-section {
    position: relative;
    min-height: 600px;
    display: flex;
    align-items: center;
    padding: 80px 0;
    overflow: hidden;

    /* Background image styling */
    background-image:
        linear-gradient(135deg, rgba(26, 26, 26, 0.85) 0%, rgba(74, 74, 74, 0.75) 100%),
        url('img/hero-background-optimized.jpg');
    /* Zoptymalizowana wersja oryginału */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    /* background-attachment: fixed; */
    /* Parallax effect - REMOVED for performance */
}

/* Alternative: If you want to add image via HTML */
.hero-background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.85) 0%, rgba(74, 74, 74, 0.75) 100%);
    z-index: 2;
}

.hero-container {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h2 {
    margin-bottom: 1.5rem;
    color: var(--bg-white);
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
}

.hero-badge {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.benefits-list {
    margin-top: 2rem;
}

.benefits-list p {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: var(--bg-white);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   FORM STYLES
   ============================================ */
.form-container {
    background-color: var(--bg-white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.form-title {
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-size: 1.8rem;
}

.form-subtitle {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-gray);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.form-input,
.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: var(--transition);
    background-color: var(--bg-white);
    color: var(--text-dark);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 25px;
    gap: 10px;
}

.checkbox-input {
    margin-top: 4px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-gray);
}

.checkbox-label a {
    color: var(--primary-color);
    text-decoration: underline;
}

.checkbox-label a:hover {
    color: var(--primary-hover);
}

.btn {
    display: block;
    width: 100%;
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding: 16px 30px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.form-message {
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* ============================================
   MODELS SECTION
   ============================================ */
.models-section {
    padding: 100px 0;
    background-color: var(--bg-lighter);
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
    color: var(--text-dark);
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.model-card {
    background-color: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.model-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.model-image-container {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--border-color) 100%);
}

.model-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.model-card:hover .model-image {
    transform: scale(1.08);
}

.model-content {
    padding: 30px;
}

.model-name {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.price-section {
    margin-bottom: 20px;
}

.price-main {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

.price-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.financing-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.financing-info {
    flex-grow: 1;
}

.financing-amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
    display: block;
}

.financing-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.kinto-badge {
    background-color: var(--bg-dark);
    color: var(--bg-white);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ============================================
   NOT FOUND SECTION
   ============================================ */
.not-found-section {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
    padding: 60px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.not-found-content {
    max-width: 700px;
    margin: 0 auto;
}

.not-found-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.not-found-text {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: var(--text-gray);
}

.btn-secondary {
    display: inline-block;
    background-color: var(--bg-dark);
    color: var(--bg-white);
    padding: 16px 40px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-secondary:hover {
    background-color: var(--text-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   FEATURES SECTION
   ============================================ */
.features-section {
    padding: 100px 0;
    background-color: var(--bg-white);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.feature-card {
    text-align: center;
    padding: 30px 20px;
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 25px;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--border-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: bold;
}

.feature-title {
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.feature-description {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ============================================
   DEALERSHIPS SECTION
   ============================================ */
.dealerships-section {
    padding: 100px 0;
    background-color: var(--bg-lighter);
}

.dealerships-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.dealership-card {
    background-color: var(--bg-white);
    padding: 40px 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 2px solid var(--border-color);
}

.dealership-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.dealership-name {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-dark);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

.dealership-info {
    margin-bottom: 15px;
}

.info-label {
    font-weight: 600;
    color: var(--text-dark);
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.info-value {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-value a {
    color: var(--primary-color);
    font-weight: 600;
}

.info-value a:hover {
    text-decoration: underline;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background-color: var(--bg-dark);
    color: var(--bg-white);
    padding: 70px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 50px;
    margin-bottom: 50px;
}

.footer-section h3 {
    color: var(--bg-white);
    margin-bottom: 25px;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}

.footer-section p {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: underline;
}

.footer-bottom a:hover {
    color: var(--primary-color);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 992px) {
    .header-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }

    .logo-container {
        justify-content: center;
    }

    .header-spacer {
        display: none;
    }

    .hero-section {
        background-attachment: scroll;
        /* Better performance on mobile */
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .models-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 20px 0;
    }

    .contact-info {
        order: 2;
    }

    .hero-section {
        min-height: 500px;
        padding: 50px 0;
    }

    .form-container {
        padding: 30px 20px;
    }

    .models-section,
    .features-section,
    .dealerships-section {
        padding: 60px 0;
    }

    .models-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 15px;
    }

    .logo-image {
        max-height: 50px;
    }

    .hero-section {
        min-height: 400px;
    }

    .form-container {
        padding: 25px 15px;
    }

    .model-content,
    .dealership-card {
        padding: 20px;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */
@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;
    }

    .hero-section {
        background-attachment: scroll !important;
    }
}

/* Lazy load images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}