﻿:root {
    --bg: #f5f1e9;
    --surface: #fffdf8;
    --ink: #1f251f;
    --muted: #667060;
    --line: #ddd6c8;
    --brand: #2f6f50;
    --brand-dark: #23543c;
    --danger: #b42318;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a { color: inherit; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar-inner,
.wrap {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 264px;
    height: 50px;
    text-decoration: none;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    width: 264px;
    height: 50px;
    transform-origin: center;
}

.brand-mark,
.brand-word {
    display: block;
    flex: 0 0 auto;
    background: url('/assets/brand-logo.jpeg') no-repeat;
}

.brand-mark {
    width: 40px;
    height: 27px;
    background-size: 145px 109px;
    background-position: -4px -41px;
}

.brand-word {
    position: relative;
    top: 4px;
    width: 218px;
    height: 30px;
    background-size: 318px 238px;
    background-position: -103px -110px;
}

.nav,
.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

.wrap { padding: 28px 0 48px; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
}

h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

p { line-height: 1.6; }
.muted { color: var(--muted); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.card { overflow: hidden; }
.panel { padding: 20px; }

.card img,
.detail-main {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #e8ece6;
}

.card-body { padding: 16px; }
.card-title { margin: 0 0 10px; font-size: 20px; }

.price,
.detail-price {
    margin: 0 0 12px;
    color: var(--brand);
    font-size: 20px;
    font-weight: 800;
}

.detail-price {
    font-size: 24px;
}

.button,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover,
button:hover,
input[type="submit"]:hover { background: var(--brand-dark); }
.button.secondary { background: #ebe5d8; color: var(--ink); }
.button.danger { background: var(--danger); }

.form { display: grid; gap: 15px; }

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}

textarea { min-height: 180px; resize: vertical; }

.error {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    background: #ffe7e5;
    color: #8d1f16;
}

.upload-progress {
    display: grid;
    gap: 9px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.upload-progress[hidden] {
    display: none;
}

.upload-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--ink);
}

.upload-progress progress {
    width: 100%;
    height: 14px;
    border: 0;
    border-radius: 7px;
    overflow: hidden;
    accent-color: var(--brand);
}

.upload-progress progress::-webkit-progress-bar {
    background: #e7e1d5;
}

.upload-progress progress::-webkit-progress-value {
    background: var(--brand);
}

.upload-progress progress::-moz-progress-bar {
    background: var(--brand);
}

button:disabled,
input[type="submit"]:disabled {
    cursor: wait;
    opacity: 0.65;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.table th { background: #ebe5d8; }

.thumb {
    width: 76px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

.detail-layout > .panel {
    min-width: 0;
}

.admin-wrap {
    display: grid;
    gap: 22px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    display: grid;
    gap: 8px;
}

.stat-card strong {
    font-size: 28px;
    line-height: 1;
}

.stat-label {
    color: var(--muted);
    font-weight: 700;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.top-listings {
    display: grid;
    gap: 12px;
}

.top-listing-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.top-listing-item:first-child {
    border-top: 0;
    padding-top: 0;
}

@media (max-width: 720px) {
    .topbar-inner,
    .wrap {
        width: min(1120px, calc(100% - 20px));
    }

    .topbar-inner {
        min-height: 56px;
        padding: 8px 0;
        justify-content: center;
    }

    .brand {
        align-self: center;
        width: 201px;
        height: 40px;
        margin-top: 0;
    }

    .brand-lockup {
        transform: scale(.76);
    }

    .wrap {
        padding: 16px 0 32px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .top-listing-item {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .top-listing-item .button {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .card-body {
        padding: 14px;
    }

    .price,
    .detail-price {
        font-size: 18px;
    }

    h1 {
        font-size: 28px;
    }
}

.detail-layout .panel h1 {
    max-width: 100%;
    font-size: 34px;
    line-height: 1.12;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.listing-description {
    max-width: 100%;
    margin: 24px 0 0;
    line-height: 1.7;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-line;
}

.login-panel {
    max-width: 460px;
}

.validation-summary-valid {
    display: none;
}

.nav form {
    margin: 0;
}

.gallery,
.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.gallery img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
}

.gallery-viewer {
    display: grid;
    gap: 12px;
}

.listing-video,
.video-edit video {
    display: block;
    width: 100%;
    max-height: 560px;
    border-radius: 8px;
    background: #111;
}

.listing-video[hidden] {
    display: none;
}

.video-edit {
    display: grid;
    gap: 10px;
}

.video-edit video {
    max-width: 520px;
    max-height: 300px;
}

.media-stage {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
}

.media-stage .detail-main,
.media-stage .listing-video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
}

.media-stage .listing-video {
    object-fit: contain;
    border-radius: 0;
}

.media-stage [hidden] {
    display: none;
}

.gallery-thumbs {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    margin-top: 0;
}

.gallery-thumb {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: transparent;
    overflow: hidden;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    border-color: var(--brand);
    background: transparent;
}

.gallery-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.video-thumb-content {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #202522;
}

.video-thumb-preview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.video-thumb-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
}

.video-thumb-overlay::before {
    content: '';
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
}

.play-mark {
    position: relative;
    z-index: 1;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 11px solid #fff;
    margin-left: 3px;
}

.image-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.image-check {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    font-weight: 400;
}

.image-check img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.whatsapp-float {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    min-height: 54px;
    padding: 0;
    border-radius: 50%;
    background: #1f9d55;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(15, 42, 28, 0.24);
    transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.whatsapp-float:hover {
    background: #168246;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 42, 28, 0.3);
}

.whatsapp-float:focus-visible {
    outline: 3px solid rgba(31, 157, 85, 0.35);
    outline-offset: 3px;
}

.whatsapp-float svg {
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 760px) {
    .topbar-inner,
    .page-head { align-items: flex-start; flex-direction: column; }
    .detail-layout { grid-template-columns: 1fr; }
    .table { display: block; overflow-x: auto; }
    .button,
    button,
    input[type="submit"] { width: 100%; }
    .gallery-thumbs { grid-template-columns: repeat(4, 1fr); }
    .detail-layout .panel h1 { font-size: 28px; }
    .whatsapp-float {
        right: max(14px, env(safe-area-inset-right));
        bottom: max(14px, env(safe-area-inset-bottom));
        width: 54px;
        min-height: 54px;
        justify-content: center;
        padding: 0;
    }
}
