/* ============================================
   EscapeWorld - Haupt-CSS
   Stil: Dunkles Abenteuer-Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== RESET & ROOT ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-base: #0a0c10;
    --bg-surface: #111419;
    --bg-card: #161b24;
    --bg-elevated: #1e2535;
    --bg-hover: #242d3f;

    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --border-accent: rgba(212,175,55,0.3);

    --gold: #d4af37;
    --gold-light: #f0d060;
    --gold-dim: rgba(212,175,55,0.15);

    --red: #c0392b;
    --red-bright: #e74c3c;
    --green: #27ae60;
    --blue: #2980b9;
    --purple: #8e44ad;

    --text-primary: #e8e0d0;
    --text-secondary: #9a9080;
    --text-dim: #5a5248;
    --text-gold: #d4af37;

    --font-display: 'Cinzel', serif;
    --font-body: 'Crimson Pro', serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
    --shadow-gold: 0 0 20px rgba(212,175,55,0.15);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);

    --transition: 0.2s ease;
    --transition-slow: 0.4s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    font-size: 17px;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }
a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(10,12,16,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 2rem;
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--gold) !important;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: var(--shadow-gold);
    flex-shrink: 0;
}

.navbar-brand svg { width: 28px; height: 28px; }

.navbar-nav {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin-left: auto;
    align-items: center;
}

.navbar-nav a {
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: all var(--transition);
}

.navbar-nav a:hover,
.navbar-nav a.active { color: var(--text-primary); background: var(--bg-elevated); }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--bg-card);
    border-radius: 40px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}
.navbar-user:hover { border-color: var(--border-accent); }

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--gold-dim);
    border: 1px solid var(--border-accent);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--gold);
    flex-shrink: 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== HERO ===== */
.hero {
    position: relative;
    padding: 100px 0 80px;
    overflow: hidden;
    text-align: center;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(212,175,55,0.08) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 20% 100%, rgba(192,57,43,0.06) 0%, transparent 60%);
    pointer-events: none;
}

.hero-eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gold);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    border: 1px solid var(--border-accent);
    padding: 4px 16px;
    border-radius: 40px;
    margin-bottom: 1.5rem;
    background: var(--gold-dim);
}

.hero h1 {
    background: linear-gradient(135deg, #e8e0d0 0%, #d4af37 50%, #e8e0d0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

.hero-sub {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 2.5rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.hero-stat { text-align: center; }
.hero-stat-number {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--gold);
    display: block;
}
.hero-stat-label { font-size: 0.8rem; color: var(--text-dim); letter-spacing: 0.1em; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gold);
    color: #0a0c10;
    border-color: var(--gold);
}
.btn-primary:hover {
    background: var(--gold-light);
    color: #0a0c10;
    box-shadow: 0 0 24px rgba(212,175,55,0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }

.btn-danger {
    background: var(--red);
    color: white;
    border-color: var(--red);
}
.btn-danger:hover { background: var(--red-bright); }

.btn-sm { padding: 6px 14px; font-size: 0.78rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-elevated);
}

.card-img-placeholder {
    width: 100%;
    height: 200px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 3rem;
}

.card-body { padding: 1.25rem; }
.card-title { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 0.5rem; }
.card-text { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 0; }

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* ===== STORY GRID ===== */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.story-card { cursor: pointer; }

.story-card .badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 40px;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
    font-weight: 500;
    white-space: nowrap;
}

.badge-difficulty-easy { background: rgba(39,174,96,0.15); color: #2ecc71; border: 1px solid rgba(39,174,96,0.2); }
.badge-difficulty-medium { background: rgba(212,175,55,0.15); color: #d4af37; border: 1px solid rgba(212,175,55,0.2); }
.badge-difficulty-hard { background: rgba(192,57,43,0.15); color: #e74c3c; border: 1px solid rgba(192,57,43,0.2); }
.badge-difficulty-expert { background: rgba(142,68,173,0.15); color: #9b59b6; border: 1px solid rgba(142,68,173,0.2); }

.badge-gray { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-gold { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--border-accent); }

.story-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 0.75rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.rating-stars { color: var(--gold); letter-spacing: 1px; font-size: 0.8rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

label .required { color: var(--red-bright); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition);
    outline: none;
    -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}

input::placeholder { color: var(--text-dim); }
textarea { resize: vertical; min-height: 100px; }

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9080' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select option { background: var(--bg-card); }

.form-hint { font-size: 0.8rem; color: var(--text-dim); margin-top: 4px; }
.form-error { font-size: 0.8rem; color: var(--red-bright); margin-top: 4px; }

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

@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ===== AUTH PAGES ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse 60% 60% at 10% 90%, rgba(192,57,43,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 60% at 90% 10%, rgba(212,175,55,0.06) 0%, transparent 60%),
        var(--bg-base);
}

.auth-box {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-icon {
    width: 64px;
    height: 64px;
    background: var(--gold-dim);
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 1rem;
}

.alert-error { background: rgba(192,57,43,0.15); border: 1px solid rgba(192,57,43,0.3); color: #e74c3c; }
.alert-success { background: rgba(39,174,96,0.15); border: 1px solid rgba(39,174,96,0.3); color: #2ecc71; }
.alert-warning { background: rgba(212,175,55,0.15); border: 1px solid rgba(212,175,55,0.3); color: var(--gold); }
.alert-info { background: rgba(41,128,185,0.15); border: 1px solid rgba(41,128,185,0.3); color: #3498db; }

/* ===== FILTER BAR ===== */
.filter-bar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 64px;
    z-index: 100;
}

.filter-bar-inner {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.filter-search input {
    padding-left: 38px;
}

.filter-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.filter-select select {
    width: auto;
    min-width: 140px;
}

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-top: 2rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--text-primary);
}

.section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 1.5rem;
}

/* ===== DIVIDER ===== */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.divider-text::before,
.divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ===== TABS ===== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    padding: 10px 16px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:hover td { background: var(--bg-elevated); }

/* ===== MAP ===== */
.map-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

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

/* Google Maps dark override */
.gm-style { background: #0d1117 !important; }

/* ===== LOADING ===== */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 2rem auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon { font-size: 4rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { color: var(--text-primary); margin-bottom: 0.5rem; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 12px 18px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    max-width: 340px;
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
}

.toast.success { border-color: rgba(39,174,96,0.4); }
.toast.error { border-color: rgba(192,57,43,0.4); }

@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }

/* ===== MODAL ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 540px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    transition: color var(--transition);
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; gap: 1rem; }
    .container { padding: 0 1rem; }
    .story-grid { grid-template-columns: 1fr; }
    .auth-box { padding: 1.5rem; }
    .hero { padding: 60px 0 40px; }
    .navbar-nav .nav-text { display: none; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--red-bright); }
.text-success { color: var(--green); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ===== ACTIVE SESSION BANNER ===== */
.active-session-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    width: calc(100% - 2rem);
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-gold), var(--shadow-lg);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.active-session-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.active-session-img {
    width: 52px; height: 52px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
}

.active-session-img-placeholder {
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}

.active-session-info { flex: 1; min-width: 0; }

.active-session-label {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--green);
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.active-session-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active-session-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.active-session-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.active-session-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 6px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.active-session-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

@media (max-width: 500px) {
    .active-session-banner { bottom: 12px; }
    .active-session-meta { display: none; }
}
