/* ============================================
   Quinn & Otis Verhalen - Stylesheet
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f7f5f2;
    min-height: 100vh;
    color: #1a1a1a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ---- SIDEBAR ---- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #e8e4df;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid #eae6de;
    background: linear-gradient(135deg, #eae6de 0%, #f0ece5 100%);
}

.sidebar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e6b;
    letter-spacing: -0.02em;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.sidebar-close:hover {
    color: #333;
}

.sidebar-search {
    padding: 12px 16px;
    border-bottom: 1px solid #f0ece5;
}

.sidebar-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    background: #f9f7f4;
    transition: border-color 0.2s;
}

.sidebar-search-input:focus {
    outline: none;
    border-color: #8b9cc7;
    background: #fff;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    padding: 12px 16px 6px;
}

.sidebar-story-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: #444;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-story-link:hover {
    background: #f5f3f0;
    color: #2c3e6b;
}

.sidebar-story-link.active {
    background: #eef0f7;
    color: #2c3e6b;
    font-weight: 600;
    border-left-color: #5a6fa8;
}

.sidebar-story-link.crystal {
    color: #7a5f0a;
}

.sidebar-story-link.crystal.active {
    border-left-color: #d4a017;
    background: #fdf8f0;
}

.sidebar-series-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4a017;
    flex-shrink: 0;
}

.sidebar-story-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-chapters {
    border-top: 1px solid #eae6de;
    padding: 0 0 12px;
    max-height: 40vh;
    overflow-y: auto;
}

.sidebar-chapter-link {
    display: block;
    padding: 6px 16px 6px 24px;
    font-size: 0.8rem;
    color: #666;
    transition: all 0.15s;
}

.sidebar-chapter-link:hover {
    color: #2c3e6b;
    background: #f5f3f0;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

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

/* ---- HEADER ---- */

.header {
    background: linear-gradient(135deg, #eae6de 0%, #f0ece5 100%);
    border-bottom: 1px solid #ddd8cf;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #555;
    border-radius: 2px;
    transition: all 0.2s;
}

.hamburger:hover span {
    background: #2c3e6b;
}

.header-title {
    flex: 1;
}

.header-title a {
    display: block;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #2c3e6b;
    line-height: 1.3;
}

.header-title p {
    font-size: 0.8rem;
    color: #8a8070;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-search-form {
    display: none;
}

.header-search-input {
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    width: 180px;
    background: #fff;
    transition: border-color 0.2s, width 0.2s;
}

.header-search-input:focus {
    outline: none;
    border-color: #8b9cc7;
    width: 220px;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #2c3e6b;
    color: #fff;
    transition: all 0.15s;
}

.header-btn:hover {
    background: #3d5291;
}

.header-btn-subtle {
    background: transparent;
    color: #888;
    font-weight: 500;
}

.header-btn-subtle:hover {
    background: rgba(0,0,0,0.05);
    color: #555;
}

/* ---- MAIN CONTENT ---- */

.main-content {
    transition: margin-left 0.3s ease;
}

.content-area {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 24px 64px;
}

/* ---- MAP ---- */

.map-container {
    margin-bottom: 28px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e0dce8;
    box-shadow: 0 2px 12px rgba(44, 62, 107, 0.06);
}

.world-map {
    height: 300px;
    background: #e8e4f0;
}

/* ---- STORY LIST ---- */

.story-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.story-card {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #eae8e4;
    border-left: 3px solid #8b9cc7;
    border-radius: 10px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.story-card:hover {
    border-color: #b8c4e0;
    border-left-color: #5a6fa8;
    box-shadow: 0 4px 16px rgba(44, 62, 107, 0.08);
}

.story-card:active {
    transform: scale(0.995);
}

.story-card.crystal {
    border-left-color: #d4a017;
    background: linear-gradient(135deg, #fffdf7 0%, #fff 100%);
}

.story-card.crystal:hover {
    border-color: #ece0c0;
    border-left-color: #b8880e;
    box-shadow: 0 4px 16px rgba(180, 140, 20, 0.08);
}

.story-card-content {
    flex: 1;
}

.story-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e6b;
    margin-bottom: 3px;
    line-height: 1.4;
}

.story-card.crystal .story-card-title {
    color: #7a5f0a;
}

.story-card-location {
    font-size: 0.8rem;
    color: #999;
}

.story-card-arrow {
    font-size: 1.4rem;
    color: #ccc;
    padding-left: 12px;
    transition: color 0.15s;
}

.story-card:hover .story-card-arrow {
    color: #8b9cc7;
}

.series-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #fdf3d7 0%, #fce9b0 100%);
    color: #7a5f0a;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    letter-spacing: 0.01em;
    vertical-align: middle;
}

/* ---- SERIES ---- */

.series-section {
    margin-bottom: 28px;
}

.series-header {
    margin: 0 4px 12px;
}

.series-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #2c3e6b;
}

.series-header p {
    font-size: 0.85rem;
    color: #888;
    margin-top: 2px;
}

.series-header.crystal h2 {
    color: #7a5f0a;
}

.series-header.droomgilde h2 {
    color: #3d2c7a;
}

.series-banner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 28px;
    padding: 20px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1f1a4d 0%, #3d2c7a 60%, #5b3f9e 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(45, 30, 110, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.series-banner:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(45, 30, 110, 0.32);
}

.series-banner-label {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2a1f00;
    background: #f2c94c;
    padding: 2px 10px;
    border-radius: 20px;
}

.series-banner-title {
    font-family: 'Lora', serif;
    font-size: 1.5rem;
    font-weight: 600;
}

.series-banner-text {
    font-size: 0.9rem;
    color: #ddd6f5;
}

.story-card.droomgilde {
    border-left-color: #5b3f9e;
    background: linear-gradient(135deg, #f7f4ff 0%, #fff 100%);
}

.story-card.droomgilde:hover {
    border-color: #d9cff2;
    border-left-color: #3d2c7a;
    box-shadow: 0 4px 16px rgba(61, 44, 122, 0.1);
}

.story-card.droomgilde .story-card-title {
    color: #3d2c7a;
}

.story-card.droomgilde .series-badge {
    background: linear-gradient(135deg, #3d2c7a 0%, #5b3f9e 100%);
    color: #f2c94c;
}

.sidebar-story-link.droomgilde {
    color: #3d2c7a;
}

.sidebar-story-link.droomgilde.active {
    border-left-color: #5b3f9e;
    background: #f5f2fd;
}

.sidebar-story-link.droomgilde .sidebar-series-dot {
    background: #5b3f9e;
}

.story-series {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5a6fa8;
    margin-bottom: 12px;
}

.story-series.crystal {
    color: #b8880e;
}

.story-series.droomgilde {
    color: #5b3f9e;
}

/* ---- STORY MAP ---- */

.story-map-container {
    margin-bottom: 28px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e0dce8;
    box-shadow: 0 2px 12px rgba(44, 62, 107, 0.06);
}

.story-map {
    height: 200px;
    background: #e8e4f0;
}

/* ---- STORY VIEW ---- */

.story-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.back-button {
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #ddd;
    color: #666;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}

.back-button:hover {
    border-color: #8b9cc7;
    color: #2c3e6b;
    background: #f3f1f8;
}

.edit-button {
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    background: #2c3e6b;
    color: #fff;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}

.edit-button:hover {
    background: #3d5291;
}

/* ---- STORY CONTENT ---- */

.story-content {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 1.1rem;
    line-height: 1.85;
    color: #2d2d2d;
    max-width: 700px;
}

.story-content h1 {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e6b;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin-bottom: 36px;
}

.story-content h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #4a5e94;
    margin-top: 48px;
    margin-bottom: 18px;
    letter-spacing: -0.01em;
}

.story-content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #555;
    margin-top: 28px;
    margin-bottom: 12px;
}

.story-content p {
    margin-bottom: 18px;
}

.story-content strong {
    font-weight: 600;
    color: #1a1a1a;
}

.story-content em {
    font-style: italic;
}

.story-content hr {
    border: none;
    height: 1px;
    background: #e0ddd8;
    margin: 40px 0;
}

.story-content a {
    color: #4a6fa5;
    text-decoration: underline;
    text-decoration-color: rgba(74, 111, 165, 0.3);
    text-underline-offset: 3px;
    transition: all 0.15s;
}

.story-content a:hover {
    color: #2c5282;
    text-decoration-color: #4a6fa5;
}

.story-content ul,
.story-content ol {
    margin-bottom: 18px;
    padding-left: 24px;
}

.story-content li {
    margin-bottom: 8px;
}

.story-content blockquote {
    border-left: 3px solid #c5b8d4;
    padding-left: 20px;
    margin: 24px 0;
    color: #666;
    font-style: italic;
}

/* Slaap lekker closing */
.story-closing {
    text-align: center;
    color: #7a6e5d;
    padding: 28px 24px;
    background: linear-gradient(135deg, #fdf8f0 0%, #f6f0e6 100%);
    border: 1px solid #e8dfd2;
    border-radius: 12px;
    margin: 8px 0 40px;
    font-style: italic;
}

/* Info section */
.story-info {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    line-height: 1.75;
    color: #444;
    background: #fff;
    border: 1px solid #eae8e4;
    border-radius: 14px;
    padding: 32px 28px;
    margin-top: 16px;
}

.story-info h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e6b;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e0dce8;
}

.story-info h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5e94;
    margin-top: 28px;
    margin-bottom: 10px;
}

.story-info h2 + h3 {
    margin-top: 0;
}

.story-info p {
    margin-bottom: 12px;
}

.story-info ul {
    margin-bottom: 12px;
    padding-left: 20px;
}

.story-info li {
    margin-bottom: 8px;
}

.story-info a {
    color: #5a6abf;
    text-decoration: underline;
    text-decoration-color: rgba(90, 106, 191, 0.3);
    text-underline-offset: 2px;
}

.story-info a:hover {
    text-decoration-color: #5a6abf;
}

/* ---- FLASH MESSAGES ---- */

.flash-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 12px 24px 0;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.flash-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ---- LOGIN ---- */

.login-container {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    border: 1px solid #eae8e4;
    border-radius: 14px;
    padding: 40px 32px;
}

.login-container h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e6b;
    margin-bottom: 24px;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---- FORMS ---- */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #8b9cc7;
}

.form-check {
    flex-direction: row;
    align-items: center;
}

.form-check label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.btn-primary {
    background: #2c3e6b;
    color: #fff;
}

.btn-primary:hover {
    background: #3d5291;
}

.btn-secondary {
    background: #f0ece5;
    color: #555;
}

.btn-secondary:hover {
    background: #e5e0d8;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-danger:hover {
    background: #fecaca;
}

/* ---- EDITOR ---- */

.editor-container {
    max-width: 900px;
}

.editor-container h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e6b;
    margin-bottom: 24px;
}

.editor-meta {
    background: #fff;
    border: 1px solid #eae8e4;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.editor-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ---- SEARCH ---- */

.search-container h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e6b;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: #8b9cc7;
}

.search-summary {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 16px;
}

.search-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 0.95rem;
}

/* ---- LOADING & ERROR ---- */

.loading {
    text-align: center;
    padding: 48px 24px;
    color: #999;
    font-size: 0.9rem;
}

.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 16px 20px;
    border-radius: 10px;
    color: #b91c1c;
    font-size: 0.9rem;
}

/* ---- LEAFLET CUSTOM MARKERS ---- */

.marker-normal {
    background: #5a6fa8;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.marker-crystal {
    background: #d4a017;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    box-shadow: 0 2px 8px rgba(180, 140, 20, 0.4);
}

.marker-droomgilde {
    background: #5b3f9e;
    border: 2px solid #f2c94c;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    box-shadow: 0 2px 8px rgba(61, 44, 122, 0.45);
}

/* ---- RESPONSIVE: DESKTOP ---- */

@media (min-width: 768px) {
    .header-search-form {
        display: block;
    }

    .main-content.sidebar-open {
        margin-left: 280px;
    }

    .sidebar-overlay {
        display: none;
    }
}

/* ---- RESPONSIVE: MOBILE ---- */

@media (max-width: 767px) {
    .header-inner {
        padding: 12px 16px;
    }

    .header-title h1 {
        font-size: 1.1rem;
    }

    .header-title p {
        font-size: 0.75rem;
    }

    .content-area {
        padding: 16px 16px 48px;
    }

    .world-map {
        height: 220px;
    }

    .story-map {
        height: 160px;
    }

    .story-card {
        padding: 14px 16px;
    }

    .story-card-title {
        font-size: 0.9rem;
    }

    .story-card-location {
        font-size: 0.75rem;
    }

    .back-button {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    .story-content {
        font-size: 1.05rem;
        line-height: 1.8;
    }

    .story-content h1 {
        font-size: 1.5rem;
        margin-bottom: 28px;
    }

    .story-content h2 {
        font-size: 1.1rem;
        margin-top: 36px;
    }

    .story-content h3 {
        font-size: 1rem;
    }

    .story-closing {
        padding: 20px 16px;
        font-size: 0.95rem;
    }

    .story-info {
        padding: 24px 20px;
        font-size: 0.85rem;
        border-radius: 12px;
    }

    .story-info h2 {
        font-size: 1rem;
    }

    .login-container {
        margin: 24px 16px;
        padding: 28px 20px;
    }

    .editor-meta {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 12px;
    }

    .editor-actions {
        flex-wrap: wrap;
    }

    .search-form {
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    .header-title h1 {
        font-size: 1rem;
    }

    .story-content {
        font-size: 1rem;
    }

    .story-content h1 {
        font-size: 1.35rem;
    }
}
