@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #ffffff;
    --card: #ffffff;
    --text: #000000;
    --muted: #666666;
    --line: #e0e0e0;
    --accent: #000000;
    --accent-dark: #333333;
    --danger: #000000;
    --navy: #000000;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

img, video {
    max-width: 100%;
    height: auto;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: min(1200px, 92vw);
    margin: 0 auto;
}

.topbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--text);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.125rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--muted);
}

.page {
    padding: 3rem 0;
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 110px;
    background: var(--bg);
    border-right: 1px solid var(--line);
    padding-right: 1.5rem;
}

.sidebar-label {
    margin: 0 0 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-nav {
    display: grid;
    gap: 0.5rem;
}

.sidebar-link {
    text-decoration: none;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-link:hover {
    color: var(--text);
    background: #f5f5f5;
}

.sidebar-link.active {
    color: var(--bg);
    background: var(--text);
}

.content-area {
    min-width: 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 2.5rem;
    margin-bottom: 2rem;
    border-radius: 0;
}

.hero h1,
.card h1,
.card h2,
.card h3 {
    margin-top: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.card h1 { font-size: 2rem; }
.card h2 { font-size: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.card h3 { font-size: 1.25rem; }

.muted {
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat.card {
    padding: 2rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--text);
    box-shadow: 4px 4px 0px 0px var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat.card:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px 0px var(--text);
}

.stat h3 {
    margin: 0 0 0.5rem 0;
    font-size: 3rem;
    color: var(--text);
    font-weight: 400;
}

.stat p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
}

.actions-row {
    display: flex;
    gap: 0.75rem;
}

.badge {
    display: inline-block;
    border: 1px solid var(--text);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-good {
    background: var(--text);
    color: var(--bg);
}

.badge-neutral {
    background: var(--bg);
    color: var(--text);
}

.btn,
button,
input,
select,
textarea {
    font: inherit;
    border-radius: 0;
}

.btn,
button {
    border: 1px solid var(--text);
    background: var(--bg);
    color: var(--text);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover,
button:hover {
    background: #f5f5f5;
}

.btn-primary {
    background: var(--text);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    border-color: var(--text);
    color: var(--text);
}

.btn-danger:hover {
    background: var(--text);
    color: var(--bg);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.field span {
    font-weight: 500;
    font-size: 0.9rem;
}

.field input,
.field select,
.field textarea {
    border: 1px solid var(--line);
    padding: 0.75rem;
    background: var(--bg);
    transition: border-color 0.2s;
}

.field gmp-place-autocomplete {
    width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--text);
}

.location-tools {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.location-tools .btn {
    padding: 0.6rem 0.9rem;
    font-size: 0.82rem;
}

.property-map-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.property-map-wrap > span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.property-map {
    width: 100%;
    height: 400px;
    border: 1px solid var(--line);
    background: #f0f0f0;
}

.full {
    grid-column: 1 / -1;
}

.alert {
    padding: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--text);
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--text);
    color: var(--bg);
}

.alert-error {
    background: var(--bg);
    color: var(--text);
    border-style: dashed;
}

.user-pill {
    border: 1px solid var(--text);
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.inline-form {
    display: inline;
}

.link-btn {
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 500;
    padding: 0;
    text-decoration: underline;
}

.link-btn:hover {
    background: transparent;
    color: var(--muted);
}

.auth-card {
    max-width: 480px;
    margin: 4rem auto;
    border: 1px solid var(--text);
    box-shadow: 8px 8px 0px 0px var(--text);
}

.role-hero {
    background: var(--text);
    color: var(--bg);
    border: none;
}

.role-hero h1 {
    color: var(--bg);
}

.role-hero .muted {
    color: #a0a0a0;
}

/* ── Image Gallery ──────────────────────────────────────────────────────── */

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.image-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.image-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    background: #f4f4f4;
    display: block;
}

.image-card form {
    margin: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.image-card .order-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.9em;
    font-weight: 500;
}

.image-card .order-input {
    width: 70px;
    padding: 0.35rem 0.5rem;
}

.image-card .caption-input {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
}

.image-meta {
    font-size: 0.85em;
    margin: auto 0 0 0;
}

/* ── Inline Media Uploader ─────────────────────────────────────────────── */

.media-uploader {
    display: grid;
    gap: 0.75rem;
}

.media-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.media-dropzone {
    border: 1.5px dashed var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: #fafafa;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.media-dropzone strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.media-dropzone.is-dragover,
.media-dropzone:hover,
.media-dropzone:focus {
    border-color: var(--text);
    background: #f3f3f3;
    outline: none;
}

.media-preview-empty {
    margin: 0;
    font-size: 0.9rem;
}

.media-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.75rem;
}

.media-preview-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: grid;
    gap: 0.4rem;
    padding: 0.4rem;
    cursor: grab;
}

.media-preview-item.is-dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.media-preview-item.is-dragover {
    border-color: var(--text);
    background: #f7f7f7;
}

.media-preview-handle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    padding: 0.15rem 0.45rem;
    border: 1px dashed var(--line);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
    background: #fafafa;
}

.media-preview-handle-icon {
    font-size: 0.8rem;
    line-height: 1;
    letter-spacing: -0.08em;
    color: var(--text);
}

.media-preview-thumb {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
    background: #f4f4f4;
}

.media-preview-meta {
    display: grid;
    gap: 0.15rem;
}

.media-preview-meta strong {
    font-size: 0.8rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-preview-meta .muted {
    font-size: 0.75rem;
}

.media-preview-remove {
    justify-self: start;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.media-preview-caption {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    background: #fff;
}

.media-preview-caption:focus {
    outline: none;
    border-color: var(--text);
}

/* ── Video Gallery ──────────────────────────────────────────────────────── */

.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.video-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.video-thumb-link {
    position: relative;
    display: block;
    border-radius: 6px;
    overflow: hidden;
    background: #111;
}

.video-thumb-link img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.video-play-icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 2rem;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.18));
}

.video-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.video-card form {
    margin: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 1.5rem;
    }

    .sidebar-nav {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 760px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .topbar-inner {
        min-height: 64px;
        flex-direction: column;
        padding: 1rem 0;
        gap: 1rem;
    }
}
