:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --accent-color: #f59e0b;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: #1e293b;
    --success-color: #10b981;
}

[data-theme="light"] {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-color: #d97706;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --success-color: #059669;
}

[data-theme="vintage"] {
    --bg-color: #ffc692;
    /* Dainty Apricot */
    --text-color: #62002f;
    /* Spring Lobster */
    --text-muted: #8b1a39;
    /* Refined Chianti */
    --primary-color: #bb2c1b;
    /* Red Death */
    --primary-hover: #62002f;
    /* Spring Lobster */
    --accent-color: #de6f70;
    /* Redstone */
    --glass-bg: rgba(241, 157, 117, 0.7);
    /* Balinese Sunset */
    --glass-border: rgba(98, 0, 47, 0.2);
    --card-bg: rgba(255, 198, 146, 0.95);
    /* Dainty Apricot */
    --success-color: #bb2c1b;
    /* Red Death */
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Navigation */
.glass-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    position: relative;
}

.logo {
    font-family: 'IM Fell English SC', serif;
    font-weight: 400;
    font-size: 1.75rem;
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.nav-links button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'IM Fell English SC', serif;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.3s;
    font-size: 1.1rem;
}

.nav-links button:hover,
.nav-links button.active {
    color: var(--text-color);
}

.btn-primary {
    background: var(--primary-color);
    color: white !important;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: background 0.3s !important;
}

.btn-primary:hover {
    background: var(--primary-hover) !important;
}

/* Main Content */
main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
}

/* Map View */
#map-container {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-controls {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    display: flex;
    gap: 0.5rem;
}

#search-input {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    color: var(--text-color);
    font-family: inherit;
    outline: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#btn-locate {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: background 0.3s, transform 0.2s;
}

#btn-locate:hover {
    background: var(--card-bg);
    transform: scale(1.05);
}

/* Explorer's Log */
#view-log {
    overflow-y: auto;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

#stats-container {
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    display: inline-block;
    min-width: 200px;
    border: 1px solid var(--glass-border);
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

#stat-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.visit-card {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s;
}

.visit-card:hover {
    transform: translateY(-5px);
}

.visit-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.visit-content {
    padding: 1.5rem;
}

.visit-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    /* Limit height to 90% of viewport */
    overflow-y: auto;
    /* Enable scrolling for long content */
    position: relative;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-content.small {
    max-width: 400px;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

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

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

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    font-family: inherit;
}

.btn-accent {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
}

.btn-auth {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
    background: white;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-auth.apple {
    background: black;
    color: white;
}

.divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    background: var(--card-bg);
    padding: 0 1rem;
    position: relative;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.full-width {
    width: 100%;
    margin-top: 1rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    margin-top: 1rem;
    cursor: pointer;
    width: 100%;
    text-align: center;
}

/* User Profile */
#user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary-color);
}

.hidden {
    display: none !important;
}

/* Marker Details */
.marker-meta {
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

#marker-inscription {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.marker-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--glass-border);
}

.title-font {
    font-family: 'IM Fell English SC', serif;
    font-weight: 400;
}

.btn-danger {
    background: rgba(220, 38, 38, 0.8);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: rgba(185, 28, 28, 0.9);
    transform: translateY(-2px);
}

.visit-badge {
    background: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: inline-block;
    margin-bottom: 1rem;
}

#visit-photo-display {
    width: 100%;
    border-radius: 0.5rem;
    margin-top: 1rem;
}