/* ==========================================================================
   MotorMarket theme  -  neutral design system with White / Grey themes.
   Declares color-scheme so browsers do NOT auto-dark the page.
   ========================================================================== */

/* ---- Theme tokens -------------------------------------------------------- */
:root,
:root[data-theme="light"] {
    color-scheme: light;
    --bg:        #f3f4f6;
    --surface:   #ffffff;
    --surface-2: #eceef1;
    --text:      #1b1e23;
    --muted:     #5c6673;
    --border:    #e3e6ea;
    --shadow:    0 1px 3px rgba(20,24,31,.06), 0 6px 20px rgba(20,24,31,.05);
    --accent:    #ef7d1a;   /* warm amber */
    --accent-ink:#ffffff;
    --price:     #14532d;
    --header-bg: rgba(255,255,255,.88);
}

/* Grey = warm neutral charcoal (not pure black, easy to read) */
:root[data-theme="grey"] {
    color-scheme: dark;
    --bg:        #22211f;
    --surface:   #2b2a27;
    --surface-2: #343230;
    --text:      #ece9e3;
    --muted:     #a7a199;
    --border:    #3b3834;
    --shadow:    0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
    --accent:    #f0872a;
    --accent-ink:#1b1e23;
    --price:     #86efac;
    --header-bg: rgba(43,42,39,.90);
}

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.mm {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.mm a { color: inherit; text-decoration: none; }
.mm img { max-width: 100%; display: block; }
.mm-wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.mm h1, .mm h2, .mm h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }

/* ---- Buttons ------------------------------------------------------------- */
.mm-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
    font-weight: 600; font-size: 15px; cursor: pointer; transition: .15s;
    background: var(--surface-2); color: var(--text);
}
.mm-btn:hover { filter: brightness(.97); }
.mm-btn-primary { background: var(--accent); color: var(--accent-ink); }
.mm-btn-primary:hover { filter: brightness(1.05); }
.mm-btn-ghost { background: transparent; border-color: var(--border); }

/* ---- Header -------------------------------------------------------------- */
.mm-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--header-bg); backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.mm-header .mm-wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.mm-logo { font-size: 22px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.mm-logo b { color: var(--accent); }
.mm-nav { display: flex; align-items: center; gap: 18px; margin-left: 8px; }
.mm-nav a { color: var(--muted); font-weight: 600; font-size: 15px; }
.mm-nav a:hover { color: var(--text); }
.mm-header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Theme toggle (White / Grey) */
.mm-theme-toggle {
    display: inline-flex; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px; padding: 3px;
}
.mm-theme-toggle button {
    border: 0; background: transparent; color: var(--muted);
    font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.mm-theme-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* user dropdown */
.mm-user { position: relative; }
.mm-user > a { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.mm-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.mm-menu { position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow); min-width: 180px; padding: 6px; display: none; }
.mm-user:hover .mm-menu { display: block; }
.mm-menu a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); font-size: 14px; }
.mm-menu a:hover { background: var(--surface-2); }

/* ---- Hero ---------------------------------------------------------------- */
.mm-hero { padding: 56px 0 40px; }
.mm-hero h1 { font-size: clamp(28px, 4vw, 44px); }
.mm-hero p.lead { color: var(--muted); font-size: 18px; margin: 0 0 26px; max-width: 640px; }

.mm-search {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: var(--shadow); padding: 18px;
}
.mm-search .row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mm-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.mm-field select, .mm-field input {
    width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-size: 15px; font-family: inherit;
}
.mm-search .actions { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ---- Category tiles ------------------------------------------------------ */
.mm-section { padding: 36px 0; }
.mm-section h2 { font-size: 24px; }
.mm-section .sub { color: var(--muted); margin: -4px 0 20px; }
.mm-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mm-cat {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 18px; display: flex; align-items: center; gap: 14px; transition: .15s; cursor: pointer;
}
.mm-cat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.mm-cat .ic { width: 52px; height: 36px; flex: none; color: var(--accent); }
.mm-cat .ic svg { width: 100%; height: 100%; }
.mm-cat b { font-size: 15px; }
.mm-cat span { display: block; font-size: 12.5px; color: var(--muted); }

/* ---- Car cards ----------------------------------------------------------- */
.mm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.mm-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    overflow: hidden; transition: .15s; display: flex; flex-direction: column;
}
.mm-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mm-card .ph { aspect-ratio: 4 / 3; background: var(--surface-2); position: relative; overflow: hidden; }
.mm-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.mm-card .ph .feat {
    position: absolute; top: 10px; left: 10px; background: var(--accent); color: var(--accent-ink);
    font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; letter-spacing: .02em;
}
.mm-card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mm-card .title { font-weight: 700; font-size: 15.5px; line-height: 1.3; min-height: 2.6em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mm-card .price { font-size: 19px; font-weight: 800; color: var(--price); }
.mm-card .specs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.mm-chip { font-size: 12px; color: var(--muted); background: var(--surface-2);
    border-radius: 7px; padding: 4px 8px; }
.mm-card .loc { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }

/* ---- Footer -------------------------------------------------------------- */
.mm-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 20px; }
.mm-footer .mm-wrap { padding: 32px 16px; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }
.mm-footer a { color: var(--muted); }
.mm-footer a:hover { color: var(--text); }
.mm-muted { color: var(--muted); font-size: 14px; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1000px) {
    .mm-grid { grid-template-columns: repeat(3, 1fr); }
    .mm-cats { grid-template-columns: repeat(2, 1fr); }
    .mm-search .row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .mm-grid { grid-template-columns: repeat(2, 1fr); }
    .mm-nav { display: none; }
    .mm-hero { padding: 32px 0 24px; }
    .mm-search .row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
    .mm-grid { grid-template-columns: 1fr; }
    .mm-cats { grid-template-columns: 1fr; }
}

/* ---- Logo TLD ------------------------------------------------------------ */
.mm-tld { font-size: .58em; color: var(--muted); font-weight: 700; vertical-align: baseline; }

/* ---- Search page layout -------------------------------------------------- */
.mm-layout { display: grid; grid-template-columns: 270px 1fr; gap: 22px; align-items: start; padding: 26px 0; }
.mm-side { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; position: sticky; top: 80px; }
.mm-side h3 { font-size: 15px; margin: 0 0 14px; }
.mm-side .mm-field { margin-bottom: 12px; }
.mm-results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.mm-results-head h1 { font-size: 22px; margin: 0; }
.mm-results .mm-grid { grid-template-columns: repeat(3, 1fr); }
.mm-empty { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 48px 24px; text-align: center; color: var(--muted); }
@media (max-width: 1100px) { .mm-results .mm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px)  { .mm-layout { grid-template-columns: 1fr; } .mm-side { position: static; } }
@media (max-width: 560px)  { .mm-results .mm-grid { grid-template-columns: 1fr; } }

/* ---- Ad detail page ------------------------------------------------------ */
.mm-detail { display: grid; grid-template-columns: 1.7fr 1fr; gap: 24px; align-items: start; padding: 24px 0; }
.mm-gallery .main { aspect-ratio: 16 / 10; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.mm-gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.mm-thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.mm-thumbs img { width: 92px; height: 66px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.mm-thumbs img.active { border-color: var(--accent); }
.mm-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-top: 20px; }
.mm-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.mm-spec { display: flex; flex-direction: column; gap: 2px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.mm-spec .k { font-size: 12px; color: var(--muted); }
.mm-spec .v { font-size: 15px; font-weight: 600; }
.mm-aside { position: sticky; top: 80px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.mm-aside h1 { font-size: 22px; margin: 0 0 2px; }
.mm-price-lg { font-size: 30px; font-weight: 800; color: var(--price); margin: 6px 0 4px; }
.mm-contact { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.mm-desc { line-height: 1.7; color: var(--text); }
.mm-desc img { border-radius: 8px; height: auto; }
@media (max-width: 860px) { .mm-detail { grid-template-columns: 1fr; } .mm-aside { position: static; } .mm-specs { grid-template-columns: 1fr; } }

/* ---- Forms (sell a car) -------------------------------------------------- */
.mm-formwrap { max-width: 860px; margin: 0 auto; padding: 28px 16px; }
.mm-pagehead { padding: 8px 0 18px; }
.mm-pagehead h1 { font-size: clamp(24px,3.4vw,32px); margin: 0 0 6px; }
.mm-pagehead p { color: var(--muted); margin: 0; }
.mm-form { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.mm-form h2 { font-size: 16px; margin: 26px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.mm-form h2:first-of-type { margin-top: 0; }
.mm-form .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mm-form .full { grid-column: 1 / -1; }
.mm-field textarea { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 15px; font-family: inherit; resize: vertical; }
.req { color: #e5484d; }
.mm-filebtn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; font-weight: 600; }
.mm-note { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.image-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 12px; margin-top: 12px; }
.image-preview .img-container { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.image-preview .img-container img { width: 100%; height: 120px; object-fit: cover; display: block; }
.image-preview .remove-btn { position: absolute; top: 5px; right: 5px; background: rgba(220,40,40,.88); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }
.image-preview .main-label { position: absolute; bottom: 5px; left: 5px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 5px; }

/* ---- Contact page -------------------------------------------------------- */
.mm-contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 8px 0 36px; }
.mm-ccard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.mm-ccard .ci { font-size: 22px; margin-bottom: 10px; }
.mm-ccard h3 { font-size: 15px; margin: 0 0 8px; }
.mm-ccard, .mm-ccard a { color: var(--text); }
.mm-ccard .mm-muted, .mm-ccard address { color: var(--muted); font-style: normal; line-height: 1.7; font-size: 14px; }
.mm-ccard a:hover { color: var(--accent); }
@media (max-width: 760px) { .mm-contact-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .mm-form .grid { grid-template-columns: 1fr; } }

/* ---- Auth pages (login / register) --------------------------------------- */
.mm-authwrap { max-width: 440px; margin: 0 auto; padding: 44px 16px; }
.mm-auth { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.mm-auth h1 { font-size: 22px; margin: 0 0 4px; }
.mm-auth .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.mm-auth .mm-field { margin-bottom: 14px; }
.mm .mm-gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px; border: 1px solid #dadce0; border-radius: 10px; background: #fff; color: #202124; font-weight: 600; font-size: 14px; cursor: pointer; }
.mm-gbtn:hover { box-shadow: var(--shadow); }
.mm-gbtn img { width: 18px; height: 18px; }
.mm-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.mm-divider::before, .mm-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.mm-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.mm-check input { width: 16px; height: 16px; }
.mm-auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.mm-auth-foot a { color: var(--accent); font-weight: 600; }
.mm-alert { border-radius: 10px; padding: 11px 14px; font-size: 14px; margin-bottom: 16px; }
.mm-alert.error { background: rgba(229,72,77,.12); color: #e5484d; border: 1px solid rgba(229,72,77,.32); }
.mm-alert.success { background: rgba(47,158,68,.12); color: #2f9e44; border: 1px solid rgba(47,158,68,.32); }

/* ---- Profile & my cars --------------------------------------------------- */
.mm-avatar-lg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); }
.mm-mycard-actions { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.mm-mycard-actions a { flex: 1; text-align: center; font-size: 13px; font-weight: 600; padding: 8px; border-radius: 8px; border: 1px solid var(--border); color: var(--text); }
.mm-mycard-actions a:hover { background: var(--surface-2); }
.mm-mycard-actions a.danger { color: #e5484d; border-color: rgba(229,72,77,.3); }

/* ---- Language selector --------------------------------------------------- */
.mm-lang { position: relative; }
.mm-lang-btn { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.mm-lang-btn:hover { filter: brightness(.97); }
.mm-lang-menu { position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); min-width: 180px; max-height: 340px; overflow: auto; padding: 6px; display: none; z-index: 60; }
.mm-lang-menu.open { display: block; }
.mm-lang-menu a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: 14px; cursor: pointer; white-space: nowrap; }
.mm-lang-menu a:hover { background: var(--surface-2); }
.mm-lang-menu a.pri { font-weight: 700; }
.mm-lang-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* hide the Google Translate top banner / keep layout stable */
.goog-te-banner-frame, .goog-te-gadget-icon { display: none !important; }
body { top: 0 !important; position: static !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }
#goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
font { background: transparent !important; box-shadow: none !important; }
