:root {
    --primary-red: #E50914;
    --dark-bg: #121212;
    --dark-gray: #1E1E1E;
    --light-gray: #333333;
    --text-main: #FFFFFF;
    --text-muted: #AAAAAA;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

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

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

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header & Nav */
header {
    background-color: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--light-gray);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 90px;
    padding: 5px 15px;
}

.logo {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo img {
    height: auto;
    max-height: 80px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0;
}

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-links a {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 28px;
    background-color: var(--primary-red);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background-color: #ff0a16;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
    transform: translateY(-2px);
    color: white;
}

/* Hero Section */
.hero {
    height: 100vh;
    margin-top: -80px;
    background: linear-gradient(rgba(18, 18, 18, 0.8), rgba(18, 18, 18, 0.8)), url('../assets/komis1.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 80px;
}

.hero-content h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Sections */
section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-align: center;
    text-transform: uppercase;
}

.section-title span {
    color: var(--primary-red);
}

/* About Grid */
.about-grid, .services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.card {
    background-color: var(--dark-gray);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--light-gray);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--primary-red);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--primary-red);
}

/* Cars List */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.car-card {
    background-color: var(--dark-gray);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--light-gray);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.car-card:hover {
    box-shadow: 0 10px 20px rgba(229, 9, 20, 0.15);
    border-color: var(--primary-red);
}

.car-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.car-details {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.car-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.car-price {
    font-size: 1.5rem;
    color: var(--primary-red);
    font-weight: bold;
    margin-bottom: 15px;
}

.car-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.car-specs span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.vat-badge {
    display: inline-block;
    background-color: var(--light-gray);
    color: var(--text-main);
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 15px;
    align-self: flex-start;
}

/* Filters */
.filters-bar {
    background-color: var(--dark-gray);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.filters-bar input, .filters-bar select {
    padding: 10px 15px;
    background-color: var(--light-gray);
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
    flex: 1;
    min-width: 150px;
}

.filters-bar input:focus, .filters-bar select:focus {
    outline: none;
    border-color: var(--primary-red);
}

/* Footer */
footer {
    background-color: #0a0a0a;
    padding: 60px 0 20px;
    border-top: 1px solid var(--light-gray);
}

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

.footer-col h4 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--primary-red);
}

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

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: var(--text-muted);
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--light-gray);
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Admin Panel */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background-color: var(--dark-gray);
    padding: 30px 0;
    border-right: 1px solid var(--light-gray);
}

.admin-sidebar h2 {
    text-align: center;
    color: var(--primary-red);
    margin-bottom: 30px;
    padding: 0 20px;
}

.admin-nav {
    list-style: none;
}

.admin-nav a {
    display: block;
    padding: 15px 30px;
    border-left: 3px solid transparent;
}

.admin-nav a:hover, .admin-nav a.active {
    background-color: rgba(229, 9, 20, 0.1);
    border-left-color: var(--primary-red);
    color: white;
}

.admin-content {
    flex: 1;
    padding: 40px;
    background-color: var(--dark-bg);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.admin-table th, .admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

.admin-table th {
    background-color: var(--dark-gray);
    color: var(--text-muted);
    font-weight: 600;
}

.admin-table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.action-links a {
    margin-right: 10px;
    font-size: 0.9rem;
}

.text-red { color: var(--primary-red); }
.text-green { color: #4ade80; }

/* Top Bar */
.top-bar {
    background-color: #0a0a0a;
    border-bottom: 1px solid var(--light-gray);
}

/* Floating Buttons */
.floating-btn {
    position: fixed;
    bottom: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: white !important;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 9999 !important;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.floating-btn:hover {
    transform: scale(1.1);
}
.phone-btn {
    left: 30px;
    background-color: #25D366; /* lub var(--primary-red) */
}
.phone-btn:hover {
    background-color: #1ebe5d;
}
.up-btn {
    right: 30px;
    background-color: var(--primary-red);
}
.up-btn:hover {
    background-color: #ff0a16;
}

/* Klasy przeniesione ze stylów inline — wartości 1:1 jak wcześniej,
   żeby wygląd na desktopie się nie zmienił, ale dało się je nadpisać w RWD. */
.site-main {
    padding-top: 130px;
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-red);
    margin-bottom: 20px;
}

.card-accent {
    border-top: 3px solid var(--primary-red);
}

.section-lead {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.car-cta {
    width: 100%;
    margin-top: auto;
    text-align: center;
}

/* Paginacja */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
}

.pagination > a,
.pagination > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border-radius: 4px;
    background-color: var(--dark-gray);
    border: 1px solid var(--light-gray);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.pagination > a:hover {
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.pagination .current {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: #fff;
}

.pagination .disabled {
    opacity: 0.35;
}

.pagination .ellipsis {
    background-color: transparent;
    border-color: transparent;
    min-width: 20px;
    padding: 0 4px;
    color: var(--text-muted);
}

.pagination-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--dark-gray);
        text-align: center;
        border-bottom: 1px solid var(--primary-red);
        overflow: hidden;
        max-height: 0;
        padding: 0;
        transition: max-height 0.4s ease, padding 0.4s ease;
    }
    
    .nav-links.active {
        max-height: 400px;
        padding: 20px 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* --- Strona główna: gęstsza typografia i odstępy (ok. -20%) --- */
    .site-main {
        padding-top: 104px;          /* było 130px */
    }

    section {
        padding: 64px 0;             /* było 80px */
    }

    .hero {
        height: auto;
        min-height: 78vh;
        padding-top: 64px;
        padding-bottom: 40px;
    }

    .hero-content h1 {
        font-size: 2rem;             /* było 2.5rem */
        margin-bottom: 16px;         /* było 20px */
        letter-spacing: 1px;
    }

    .hero-content p {
        font-size: 0.96rem;          /* było 1.2rem */
        margin-bottom: 24px;         /* było 30px */
    }

    .section-title {
        font-size: 2rem;             /* było 2.5rem */
        margin-bottom: 32px;         /* było 40px */
    }

    .section-lead {
        margin-bottom: 32px;
    }

    .about-grid, .services-grid {
        gap: 32px;                   /* było 40px */
        margin-top: 32px;
    }

    .card {
        padding: 24px;               /* było 30px */
    }

    .card h3 {
        font-size: 1.2rem;           /* było 1.5rem */
        margin-bottom: 12px;
    }

    .card-icon {
        font-size: 2.4rem;           /* było 3rem */
        margin-bottom: 16px;
    }

    .social-buttons {
        gap: 16px;
    }

    footer {
        padding: 48px 0 16px;        /* było 60px 0 20px */
    }

    .footer-grid {
        gap: 32px;
        margin-bottom: 32px;
    }

    .footer-col h4 {
        font-size: 1rem;
        margin-bottom: 16px;
    }

    .footer-col ul li {
        margin-bottom: 8px;
    }

    /* --- Lista ofert: zwarte karty poziome, ok. 3 na ekran telefonu --- */
    .cars-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .car-card {
        flex-direction: row;
        height: 116px;               /* 3 × 116 + 2 × 10 odstępu ≈ 368 px */
        border-radius: 6px;
        position: relative;          /* kotwica dla klikalnej całej karty */
    }

    .car-thumb {
        flex: 0 0 116px;
        height: 116px;
        display: block;
    }

    .car-image {
        width: 100%;
        height: 100%;
    }

    .car-details {
        padding: 9px 12px;
        justify-content: center;
        min-width: 0;                /* pozwala tekstowi się skracać zamiast rozpychać kartę */
    }

    .car-title {
        font-size: 0.82rem;
        line-height: 1.3;
        margin-bottom: 3px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .car-price {
        font-size: 1.05rem;
        margin-bottom: 4px;
        line-height: 1.2;
    }

    /* Zostawiamy 3 pierwsze parametry (rocznik, przebieg, paliwo) w jednym rzędzie */
    .car-specs {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        font-size: 0.68rem;
        line-height: 1.3;
        margin-bottom: 0;
        overflow: hidden;
    }

    .car-specs span {
        white-space: nowrap;
    }

    .car-specs span:nth-child(n+4) {
        display: none;
    }

    .vat-badge {
        display: none;
    }

    /* Przycisk "Szczegóły" rozciągnięty na całą kartę — bez własnego wyglądu,
       dzięki czemu cały kafelek jest jednym celem dotknięcia. */
    .car-cta {
        position: absolute;
        inset: 0;
        width: auto;
        margin: 0;
        padding: 0;
        background-color: transparent;
        border-radius: 6px;
        box-shadow: none;
        font-size: 0;
        transform: none;
    }

    .car-cta::before {
        display: none;
    }

    /* Pasek filtrów — niższy, dwa pola w rzędzie */
    .filters-bar {
        padding: 12px;
        gap: 10px;
        margin-bottom: 20px;
    }

    .filters-bar input {
        min-width: 0;
        flex: 1 1 45%;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .filters-bar .btn {
        flex: 1 1 45%;
        padding: 10px 14px !important;
        font-size: 0.85rem;
        text-align: center;
    }

    .pagination {
        gap: 6px;
        margin-top: 28px;
    }

    .pagination > a,
    .pagination > span {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 0.85rem;
    }

    /* Na wąskim ekranie same strzałki — etykiety zabierałyby całą szerokość */
    .pagination-label {
        display: none;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        padding: 20px 0;
    }
    
    .admin-nav {
        display: flex;
        overflow-x: auto;
    }
    
    .admin-nav a {
        padding: 10px 15px;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .admin-nav a:hover, .admin-nav a.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary-red);
    }
}
