/*
 * CarHub site styles on top of Bootstrap 5.3. All colours and sizes live in the variables below;
 * pages use Bootstrap classes plus the ch-* classes of this file (no other site stylesheet).
 */
:root {
    --ch-navy: #0b2a5b;          /* brand: header, footer, links */
    --ch-navy-dark: #071d40;
    --ch-accent: #ff5a1f;        /* the main action: "add an ad", "call" */
    --ch-accent-dark: #e04812;
    --ch-bg: #f3f5f9;            /* page background */
    --ch-card-radius: 14px;
    --ch-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
    --ch-shadow-hover: 0 8px 24px rgba(16, 24, 40, .12);

    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --bs-body-bg: var(--ch-bg);
    --bs-body-color: #1d2433;
    --bs-link-color: var(--ch-navy);
    --bs-link-color-rgb: 11, 42, 91;
    --bs-link-hover-color: var(--ch-accent-dark);
    --bs-primary: var(--ch-navy);
    --bs-primary-rgb: 11, 42, 91;
}

body.ch-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ch-main {
    flex: 1 0 auto;
    padding: 1.5rem 0 2.5rem;
}

/* ---------- buttons ---------- */
.btn-primary {
    --bs-btn-bg: var(--ch-navy);
    --bs-btn-border-color: var(--ch-navy);
    --bs-btn-hover-bg: var(--ch-navy-dark);
    --bs-btn-hover-border-color: var(--ch-navy-dark);
    --bs-btn-active-bg: var(--ch-navy-dark);
    --bs-btn-active-border-color: var(--ch-navy-dark);
    --bs-btn-disabled-bg: var(--ch-navy);
    --bs-btn-disabled-border-color: var(--ch-navy);
}

.btn-outline-primary {
    --bs-btn-color: var(--ch-navy);
    --bs-btn-border-color: var(--ch-navy);
    --bs-btn-hover-bg: var(--ch-navy);
    --bs-btn-hover-border-color: var(--ch-navy);
    --bs-btn-active-bg: var(--ch-navy);
    --bs-btn-active-border-color: var(--ch-navy);
}

.btn-accent {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--ch-accent);
    --bs-btn-border-color: var(--ch-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ch-accent-dark);
    --bs-btn-hover-border-color: var(--ch-accent-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--ch-accent-dark);
    --bs-btn-active-border-color: var(--ch-accent-dark);
    font-weight: 600;
}

/* ---------- header ---------- */
.ch-header {
    background: var(--ch-navy);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.ch-header .navbar {
    --bs-navbar-padding-y: .6rem;
}

.ch-header .nav-link {
    color: rgba(255, 255, 255, .85);
    font-weight: 500;
}

.ch-header .nav-link:hover,
.ch-header .nav-link:focus {
    color: #fff;
}

.ch-brand {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: 1.35rem;
    letter-spacing: .2px;
    color: #fff;
}

.ch-brand .bi {
    color: var(--ch-accent);
    font-size: 1.5rem;
}

.ch-brand b {
    color: var(--ch-accent);
}

/* ---------- footer ---------- */
.ch-footer {
    flex-shrink: 0;
    background: var(--ch-navy);
    color: rgba(255, 255, 255, .75);
    padding: 2.5rem 0 1rem;
    margin-top: auto;
}

.ch-footer a {
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
}

.ch-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

.ch-footer li {
    padding: .2rem 0;
}

.ch-footer-title {
    color: #fff;
    font-weight: 600;
    margin-bottom: .5rem;
}

.ch-footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem;
    border-top: 1px solid rgba(255, 255, 255, .15);
    margin-top: 2rem;
    padding-top: 1rem;
}

/* ---------- common blocks ---------- */
.ch-section-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.ch-panel {
    background: #fff;
    border-radius: var(--ch-card-radius);
    box-shadow: var(--ch-shadow);
    padding: 1.25rem;
}

/* ad card in grids (home, catalogue, related ads) */
.ch-ad-card {
    display: block;
    height: 100%;
    background: #fff;
    border-radius: var(--ch-card-radius);
    box-shadow: var(--ch-shadow);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: box-shadow .15s ease, transform .15s ease;
}

.ch-ad-card:hover {
    box-shadow: var(--ch-shadow-hover);
    transform: translateY(-2px);
    color: inherit;
}

.ch-ad-card .ch-ad-photo {
    aspect-ratio: 4 / 3;
    width: 100%;
    object-fit: cover;
    background: #e8ecf3;
    display: block;
}

.ch-ad-card .ch-ad-body {
    padding: .75rem .9rem .9rem;
}

.ch-ad-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ch-navy);
}

.ch-ad-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ch-ad-meta {
    font-size: .85rem;
    color: #667085;
}

/* key/value list of car details */
.ch-specs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .5rem 1.5rem;
    margin: 0;
}

.ch-specs dt {
    font-weight: 400;
    color: #667085;
    font-size: .85rem;
}

.ch-specs dd {
    margin: 0;
    font-weight: 600;
}

/* hero on the home page */
.ch-hero {
    background: linear-gradient(135deg, var(--ch-navy) 0%, #16407f 100%);
    color: #fff;
    padding: 2.5rem 0 4.5rem;
}

.ch-hero h1 {
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
}

.ch-hero-search {
    margin-top: -3rem;
}

/* sticky action bar at the bottom of phone screens (call the seller, next step) */
.ch-sticky-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: #fff;
    padding: .75rem 1rem;
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .12);
}

@media (max-width: 991.98px) {
    .ch-has-sticky-bottom {
        padding-bottom: 5rem;
    }
}

img {
    max-width: 100%;
}

/* article text from the admin editor */
.ch-article {
    font-size: 1.05rem;
    line-height: 1.7;
}

.ch-article img {
    height: auto;
    border-radius: 10px;
}

.ch-article h1, .ch-article h2, .ch-article h3 {
    font-weight: 700;
    margin-top: 1.5rem;
}

.ch-article h1:first-child {
    margin-top: 0;
}

.ch-article table {
    width: 100%;
    display: block;
    overflow-x: auto;
}

/* ---------- add / edit form (add.html) ---------- */
.ch-add-page {
    padding-bottom: 0;
}
    .step-section {
        display: none;
    }

    .step-section.active {
        display: block;
    }

    .progress {
        height: 5px;
        margin-bottom: 20px;
    }

    .btn-check:checked + .btn-outline-primary {
        background-color: #0d6efd;
        color: #fff;
    }

    /* the step buttons: held at the bottom of the screen while the form is scrolled, and resting right after
       the form at its end — above the footer, not under it (a fixed bar ended up below the footer) */
    .sticky-bottom-mobile {
        position: sticky;
        bottom: 0;
        margin: 1.5rem -12px 1.5rem;
        padding: 12px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.08);
        z-index: 1020;
    }

    .uploader-card {
        border: 2px dashed #dee2e6;
        border-radius: 10px;
        cursor: pointer;
        transition: 0.3s;
    }

    .uploader-card:hover {
        border-color: #0d6efd;
        background: #f8f9fa;
    }

    .options-group-title {
        font-size: 0.8rem;
        text-transform: uppercase;
        color: #6c757d;
        margin: 12px 0 6px;
    }

    /* Validation popup */
    #id262 {
        visibility: hidden;
        background-color: #f44336;
        color: #fff;
        text-align: center;
        border-radius: 4px;
        padding: 8px 16px;
        position: absolute;
        z-index: 2000;
        font-size: 14px;
    }

    #id262.show {
        visibility: visible;
    }

    /* Server response popup */
    #id24 {
        opacity: 0;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: white;
        padding: 30px;
        border-radius: 10px;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
        z-index: -1;
        transition: opacity 0.3s;
        max-width: 90%;
        width: 400px;
    }


/* uploaded photo tiles (upload.html, filled by add.js) */
.c21 {
    position: relative;
    width: 120px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--ch-shadow);
    cursor: pointer;
}

.c21 img, .c13 {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.closeBtn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9) url("../img/clsBttn.png") no-repeat center;
    cursor: pointer;
}

.cn3 {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9) url("../img/uncheked.png") no-repeat center;
    cursor: pointer;
    font-size: 0; /* only the tick icon, the "set as main" text stays for screen readers */
}

/* upload progress */
#span3 {
    position: relative;
    height: 6px;
    border-radius: 3px;
    background: #e5e9f0;
    overflow: hidden;
}

#myBar {
    position: absolute;
    height: 100%;
    width: 0;
    background: var(--ch-accent);
}

/* spinner overlay of library.js enableSpinner() */
.overlay_ {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(255, 255, 255, .65);
}

/* a field that failed validation (add.js) */
.input_invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .2) !important;
}

/* ---------- article editor of the admin (admin/article_edit.html) ---------- */
.ch-article-editor {
    padding-bottom: 90px; /* the sticky action bar */
}

.ch-editor-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 1rem;
    padding: .75rem 1rem;
    background: rgba(255, 255, 255, .95);
    border-top: 1px solid #dfe4ec;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 16px rgba(11, 42, 91, .08);
}

.ch-article figure img {
    max-width: 100%;
}

.ch-article figcaption {
    font-size: .875rem;
    color: #6c757d;
    margin-top: .35rem;
}

/* ---------- dealer page (dealer.html) ---------- */
.ch-dealer-logo {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    border-radius: 16px;
    object-fit: cover;
    background: #fff;
    border: 1px solid #dfe4ec;
}

.ch-dealer-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 700;
    color: #fff;
    background: var(--ch-navy, #0b2a5b);
    border: none;
}

.ch-dealer-about {
    white-space: pre-line;
}

.ch-dealer-page {
    padding-bottom: 80px; /* the call bar on phones */
}

.ch-dealer-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020;
    display: flex;
    gap: .5rem;
    padding: .6rem .75rem;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -4px 16px rgba(11, 42, 91, .12);
}

.ch-ad-dealer {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ch-navy);
}

.ch-dealer-logo-sm {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 1.4rem;
}

/* on the dealer's own page every card is its car: no name on the cards */
.ch-dealer-page .ch-ad-dealer {
    display: none;
}

/* ---------- page for car dealers (salonlar.html) ---------- */
.ch-salon-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
}

.ch-salon-steps li {
    padding: .35rem 0;
}

/* the field for robots: out of sight, not display:none (some robots skip hidden fields) */
.ch-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
