:root {
    --amber: #d4a574;
    --moss: #6b8e5a;
    --sky: #a8c5d5;
    --text-primary: #f0ede6;
    --text-secondary: #b8b1a5;
    --bg-page: #0a100d;
    --bg-card: #141a17;
    --border-color: #2a3028;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
}

body {
    overflow: hidden;
}

/* Typography */
h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 24px;
    line-height: 1.2;
}

h2 {
    font-size: 18px;
    line-height: 1.3;
}

/* App structure */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-lamp {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--moss);
    box-shadow: 0 0 6px var(--moss);
}

.upload-btn {
    padding: 10px 16px;
    background-color: var(--amber);
    color: var(--bg-page);
    border: none;
    border-radius: 6px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.upload-btn:hover {
    background-color: #e5b885;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.upload-btn:active {
    transform: translateY(0);
}

.upload-icon {
    font-size: 16px;
}

/* Main grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

.map-container {
    grid-column: 1;
    grid-row: 1;
    overflow: hidden;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.timeline-container {
    display: none;
    grid-column: 1;
    grid-row: 1;
    background-color: var(--bg-card);
    border-left: 1px solid var(--border-color);
    overflow: hidden;
    flex-direction: column;
}

.timeline-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.photo-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.timeline-item:hover {
    background-color: rgba(212, 165, 116, 0.1);
    border-color: var(--amber);
}

.timeline-item.active {
    background-color: rgba(212, 165, 116, 0.15);
    border-color: var(--amber);
}

.timeline-thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 4px;
    background-color: var(--border-color);
    overflow: hidden;
}

.timeline-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-time {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.timeline-distance {
    font-size: 12px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px 16px;
    font-size: 14px;
}

/* Detail overlay */
.detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.detail-overlay.active {
    display: flex;
}

.detail-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 500px;
    width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s ease;
}

.detail-close:hover {
    color: var(--text-primary);
}

.detail-photo {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background-color: var(--border-color);
}

.detail-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.meta-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
}

.detail-note {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-note label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-note textarea {
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease;
}

.detail-note textarea:focus {
    outline: none;
    border-color: var(--amber);
}

.detail-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.btn-danger {
    background-color: rgba(200, 80, 80, 0.2);
    color: #ff8080;
    border-color: #cc5555;
}

.btn-danger:hover {
    background-color: rgba(200, 80, 80, 0.3);
}

/* Responsive */
@media (min-width: 640px) {
    .app-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .main-grid {
        grid-template-columns: 1fr 350px;
    }

    .timeline-container {
        display: flex;
    }

    .detail-panel {
        max-width: 600px;
        width: 80vw;
    }
}

@media (max-width: 639px) {
    h1 {
        font-size: 18px;
    }

    .app-header {
        gap: 10px;
    }

    .upload-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .timeline-item {
        padding: 10px;
    }

    .timeline-thumb {
        width: 56px;
        height: 56px;
    }
}

/* Leaflet customizations */
.leaflet-container {
    background-color: var(--bg-page);
}

.leaflet-popup-content-wrapper {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.leaflet-popup-tip {
    background-color: var(--bg-card) !important;
}

.leaflet-control-attribution {
    background-color: rgba(10, 16, 13, 0.7) !important;
    color: var(--text-secondary) !important;
}

.leaflet-control-attribution a {
    color: var(--amber) !important;
}
