﻿:root {
    color-scheme: dark;
    --bg: #080808;
    --panel: #141414;
    --text: #f4f4f4;
    --muted: #b8b8b8;
    --line: #2c2c2c;
    --accent: #d71920;
    --accent-dark: #9f0f16;
    --danger: #e33131;
    --success: #ff4d57;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.6;
}

a { color: inherit; }

.site-header,
.site-footer,
.site-shell {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 0 12px;
}

.brand {
    color: var(--accent-dark);
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
}

.site-shell { margin-bottom: 40px; }

.top-menu,
.compose-panel,
.empty-state,
.post-card,
.notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.top-menu {
    display: grid;
    gap: 14px;
    padding: 16px;
    margin: 16px 0 18px;
}

.type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #1b1b1b;
    color: var(--text);
    padding: 0 14px;
    text-decoration: none;
    font-weight: 800;
}

.type-tab span {
    color: var(--muted);
    font-weight: 700;
}

.type-tab.active {
    border-color: var(--accent);
    background: #2a090b;
    color: var(--accent-dark);
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.inline-admin-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.inline-admin-form input { width: min(260px, 100%); }

h1,
h2,
h3,
p { margin-top: 0; }

h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; }

.hero-link,
.sale-link,
.add-listing-button,
button {
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
}

.hero-link:hover,
.sale-link:hover,
.add-listing-button:hover,
button:hover { background: var(--accent-dark); }

.secondary-button { background: #303030; }
.secondary-button:hover { background: #4a1115; }

.notice {
    margin: 0 0 16px;
    padding: 12px 16px;
    font-weight: 700;
}

.notice.success { color: var(--success); }
.notice.error { color: var(--danger); }

.compose-panel {
    display: grid;
    grid-template-columns: minmax(220px, 0.6fr) minmax(280px, 1.4fr);
    gap: 24px;
    padding: 24px;
    margin-bottom: 24px;
}

.compose-panel p,
.muted { color: var(--muted); }

.compose-form,
.comment-form,
.admin-form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0f0f0f;
    color: var(--text);
    font: inherit;
    padding: 10px 12px;
}

select { appearance: auto; }
textarea { resize: vertical; }

.feed {
    display: grid;
    gap: 22px;
}

.reels-feed {
    scroll-snap-type: y proximity;
}

.reel-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    min-height: min(760px, calc(100vh - 120px));
    scroll-snap-align: start;
    scroll-margin-top: 14px;
}

.empty-state {
    padding: 34px;
    text-align: center;
}

.post-card { overflow: hidden; }

.gallery-viewer { background: #111; min-width: 0; }

.gallery-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: min(760px, calc(100vh - 120px));
    background: #111;
    overflow: hidden;
}

.gallery-image {
    display: none;
    width: 100%;
    height: min(760px, calc(100vh - 120px));
    max-height: 760px;
    object-fit: contain;
    background: #111;
}

.gallery-image.active { display: block; }

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    min-height: 46px;
    padding: 0;
    border-radius: 999px;
    background: rgba(215, 25, 32, 0.9);
    font-size: 2rem;
    line-height: 1;
}

.gallery-prev { right: 14px; }
.gallery-next { left: 14px; }

.gallery-count {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 4px 12px;
    font-weight: 700;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px;
    background: #191919;
}

.gallery-thumb {
    width: 78px;
    height: 58px;
    min-height: 58px;
    flex: 0 0 auto;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: transparent;
}

.gallery-thumb.active { border-color: var(--accent); }

.gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.reel-car-actions {
    position: absolute;
    left: 14px;
    top: 50%;
    z-index: 4;
    display: grid;
    gap: 10px;
    transform: translateY(-50%);
}

.reel-car-button {
    width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    font-size: 1.35rem;
}

.reel-car-button:hover { background: rgba(215, 25, 32, 0.94); }

.post-body {
    max-height: min(760px, calc(100vh - 120px));
    overflow-y: auto;
    padding: 22px;
}

.post-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

time {
    color: var(--muted);
    font-size: 0.88rem;
}

.admin-pill,
.type-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 999px;
    background: #2a090b;
    color: var(--accent-dark);
    padding: 0 10px;
    font-size: 0.88rem;
    font-weight: 800;
}

.car-title {
    margin: 8px 0 6px;
    font-size: 1.45rem;
    line-height: 1.25;
}

.description {
    margin: 10px 0 14px;
    font-size: 1.08rem;
    white-space: pre-wrap;
}

.sale-link {
    width: fit-content;
    margin: 0 0 22px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 1px solid var(--line);
    margin-top: 18px;
    padding-top: 18px;
}

.edit-panel,
.delete-panel {
    flex: 1 1 220px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #1b1b1b;
}

.edit-panel summary,
.delete-panel summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--accent-dark);
}

.admin-form { margin-top: 12px; }

.danger-button { background: var(--danger); }
.danger-button:hover { background: #8f1118; }

.comments {
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-top: 18px;
}

.comment {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #1b1b1b;
}

.comment strong {
    display: inline-block;
    margin-left: 8px;
}

.comment p { margin: 8px 0 0; }

.comment-form {
    border-top: 1px solid var(--line);
    margin-top: 18px;
    padding-top: 18px;
}

.site-footer {
    padding: 20px 0 34px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 920px) {
    .reel-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .gallery-stage {
        min-height: min(68vh, 620px);
    }

    .gallery-image {
        height: min(68vh, 620px);
    }

    .post-body {
        max-height: none;
        overflow: visible;
    }

    .reel-car-actions {
        top: 18px;
        left: 12px;
        transform: none;
    }
}

@media (max-width: 760px) {
    .compose-panel {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .top-menu {
        position: sticky;
        top: 0;
        z-index: 10;
        margin-top: 8px;
        padding: 12px;
    }

    .type-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .type-tab {
        flex: 0 0 auto;
    }

    .gallery-stage {
        min-height: min(66vh, 560px);
    }

    .gallery-image {
        height: min(66vh, 560px);
    }

    .gallery-nav {
        width: 40px;
        min-height: 40px;
    }

    .gallery-prev { right: 10px; }
    .gallery-next { left: 10px; }

    .gallery-thumbs {
        padding: 8px;
    }

    .gallery-thumb {
        width: 66px;
        height: 50px;
        min-height: 50px;
    }

    .post-body {
        padding: 18px;
    }

    .comments,
    .comment-form {
        margin-top: 14px;
        padding-top: 14px;
    }

    .top-actions,
    .inline-admin-form { align-items: stretch; }

    .hero-link,
    .sale-link,
    .add-listing-button,
    button { width: 100%; }

    .site-shell,
    .site-header,
    .site-footer { width: min(100% - 22px, 1120px); }
}


