:root {
    --gray-900: #1a1a2e;
    --gray-800: #16213e;
    --gray-700: #2c3e6b;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --white: #ffffff;
    --blue: #3b82f6;
    --blue-dark: #2563eb;
    --green: #22c55e;
    --red: #ef4444;
    --amber: #f59e0b;
    --gold: #c9a84c;
    --gold-dark: #a68a3e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────────────────── */

nav {
    background: var(--gray-900);
    color: var(--white);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

nav .brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: .5px;
}

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

nav .nav-links a {
    color: var(--gray-200);
    text-decoration: none;
    font-size: .9rem;
    transition: color .2s;
}

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

nav .nav-links .btn-sm {
    background: var(--gold-dark);
    color: var(--white);
    padding: .4rem 1rem;
    border-radius: 4px;
    font-weight: 600;
}

/* ── Layout ─────────────────────────────────────────────────────── */

.page { padding-top: 60px; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

h1 { font-size: 1.8rem; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; margin-bottom: .75rem; }

/* ── Map ────────────────────────────────────────────────────────── */

#map {
    width: 100%;
    height: calc(100vh - 60px);
}

.mapboxgl-popup-content {
    border-radius: 8px;
    padding: 1rem;
    max-width: 320px;
    font-size: .9rem;
    line-height: 1.5;
}

.mapboxgl-popup-content h3 {
    margin-bottom: .4rem;
    color: var(--gray-900);
}

.mapboxgl-popup-content .meta {
    color: #555;
    font-size: .82rem;
    margin-bottom: .5rem;
}

.popup-photo {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: .5rem;
}

/* ── Cards ──────────────────────────────────────────────────────── */

.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* ── Forms ─────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: .3rem;
    font-size: .9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: .95rem;
    font-family: inherit;
}

.form-group textarea { min-height: 100px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: .65rem 1.4rem;
    border: none;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}

.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }

.btn-success { background: var(--green); color: var(--white); }
.btn-danger  { background: var(--red); color: var(--white); }
.btn-warning { background: var(--amber); color: var(--white); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--blue);
    color: var(--blue);
}

.btn-sm { padding: .35rem .8rem; font-size: .85rem; }

/* ── Status badges ─────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 12px;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

/* ── Table ─────────────────────────────────────────────────────── */

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

th, td {
    text-align: left;
    padding: .6rem .8rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: .9rem;
}

th { font-weight: 700; background: var(--gray-100); }

/* ── Auth forms ────────────────────────────────────────────────── */

.auth-wrapper {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 420px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    padding: 2.5rem;
}

.auth-card h1 { text-align: center; margin-bottom: 1.5rem; }

.auth-card .toggle {
    text-align: center;
    margin-top: 1rem;
    font-size: .9rem;
}

.auth-card .toggle a { color: var(--blue); text-decoration: none; }

/* ── Alerts ────────────────────────────────────────────────────── */

.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

/* ── Mini map picker ───────────────────────────────────────────── */

#pick-map {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #cbd5e1;
}

/* ── Map Pins ─────────────────────────────────────────────────── */

.map-pin {
    width: 28px;
    height: 28px;
    background: #1a1a2e;
    border: 2px solid #c9a84c;
    border-radius: 50%;
    cursor: pointer;
    transform-origin: center center;
    transition: transform .15s ease;
}

.map-pin:hover {
    transform: scale(1.3);
}

/* ── Detail Modal ──────────────────────────────────────────────── */

.detail-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(4px);
    align-items: flex-end;
    justify-content: center;
}

.detail-modal.open { display: flex; }

.detail-modal-content {
    background: var(--white);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    padding: 1.5rem;
    position: relative;
    animation: slideUp .25s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.detail-modal-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.detail-modal-close:hover { background: var(--gray-200); }

.modal-photo {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: .75rem;
}

.modal-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .4rem;
    padding-right: 2rem;
}

.modal-meta {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-bottom: .4rem;
}

.modal-tag {
    background: var(--gray-100);
    color: var(--gray-900);
    padding: .2rem .6rem;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
}

.modal-unit {
    font-size: .95rem;
    color: #444;
    font-style: italic;
    margin-bottom: .3rem;
}

.modal-dates {
    font-size: .9rem;
    color: #666;
    margin-bottom: .75rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-writeup {
    font-size: .92rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: .75rem;
}

.modal-location {
    font-size: .85rem;
    color: #555;
    margin-bottom: .25rem;
}

.modal-coords {
    font-size: .78rem;
    color: #999;
    font-family: monospace;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (min-width: 641px) {
    .detail-modal {
        align-items: center;
    }
    .detail-modal-content {
        border-radius: 16px;
        max-height: 80vh;
    }
}

@media (max-width: 640px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .auth-card { width: 95%; padding: 1.5rem; }
    nav { padding: 0 1rem; }
    nav .brand { font-size: 1rem; }

    .detail-modal-content {
        max-height: 90vh;
        padding: 1.25rem;
    }
    .modal-name { font-size: 1.2rem; }
}
