/* ====================================================
   Global resets for the timeline view
==================================================== */

html, body.timeline-view {
    height: 100%;
    margin: 0;
    padding: 0;
}

.timeline-view .site-header {
    display: none;
}

.timeline-view .site-main {
    height: 100%;
    padding: 0;
    background: transparent;
    min-height: unset;
}

/* ====================================================
   Full-page layout
==================================================== */

.timeline-page {
    min-height: 100dvh;
    background-color: #0a0906;
    background-image: var(--hero-image);
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

/* ====================================================
   Hero section (title + nav)
==================================================== */

.timeline-hero {
    position: relative;
    padding: 14px 40px 16px;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.5) 70%,
        rgba(0, 0, 0, 0.3) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.hero-nav {
    position: absolute;
    top: 16px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.hero-title {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3.5vw, 2.6rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #c8a864;
    text-shadow:
        0 2px 12px rgba(0,0,0,0.9),
        0 0 30px rgba(0,0,0,0.7);
    line-height: 1.1;
}

.hero-description {
    margin: 0;
    font-size: 1rem;
    color: rgba(220, 200, 160, 0.85);
    text-shadow: 0 1px 6px rgba(0,0,0,0.8);
    max-width: 600px;
}

.no-events {
    margin: 60px auto;
    padding: 40px 48px;
    max-width: 480px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(160, 130, 60, 0.35);
    border-radius: 8px;
    backdrop-filter: blur(6px);
    color: rgba(220, 200, 160, 0.9);
    font-size: 1.15rem;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.no-events p {
    margin: 0;
}

/* ====================================================
   Custom confirm modal
==================================================== */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.confirm-box {
    background: #1a1408;
    border: 1px solid rgba(160, 130, 60, 0.5);
    border-radius: 8px;
    padding: 28px 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.confirm-message {
    color: #d4c8a8;
    font-size: 1rem;
    margin: 0 0 22px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* ====================================================
   Navigation buttons
==================================================== */

.btn {
    display: inline-block;
    padding: 7px 14px;
    background: rgba(20, 14, 6, 0.75);
    color: #d4bc82;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
    border: 1px solid rgba(160, 130, 60, 0.45);
    backdrop-filter: blur(4px);
    transition: background 0.2s, border-color 0.2s;
}

.btn:hover {
    background: rgba(40, 30, 10, 0.9);
    border-color: rgba(200, 168, 75, 0.7);
    color: #f0d890;
}

.btn-inline {
    margin-top: 12px;
    display: inline-block;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-danger {
    border-color: rgba(160, 50, 40, 0.6);
    color: #e07060;
}

.btn-danger:hover {
    background: rgba(80, 20, 10, 0.9);
    border-color: rgba(200, 70, 55, 0.8);
    color: #f0a090;
}

.btn-update {
    border-color: rgba(60, 130, 80, 0.6);
    color: #7abf8a;
}

.btn-update:hover {
    background: rgba(20, 60, 30, 0.9);
    border-color: rgba(80, 170, 100, 0.8);
    color: #a0dfa8;
}

/* ====================================================
   Home page timeline list
==================================================== */

.timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-list-item {
    margin-bottom: 16px;
}

.timeline-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.timeline-list-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.timeline-list-link {
    font-size: 1.1rem;
    font-weight: 600;
    color: #c8a864;
    text-decoration: none;
}

.timeline-list-link:hover {
    color: #f0d890;
    text-decoration: underline;
}

.timeline-list-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
}

.timeline-date-range {
    font-size: 0.82rem;
    color: #a09060;
    font-style: italic;
}

.timeline-event-count {
    font-size: 0.78rem;
    background: rgba(160, 130, 60, 0.18);
    border: 1px solid rgba(160, 130, 60, 0.35);
    color: #a09060;
    padding: 1px 7px;
    border-radius: 10px;
}

.timeline-list-desc {
    font-size: 0.9rem;
    color: #9a8c70;
    margin-top: 4px;
}

/* ====================================================
   Manage Roles table
==================================================== */

.roles-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 600px;
}

.roles-table td {
    padding: 6px 10px;
    vertical-align: middle;
}

.role-order-btns {
    width: 80px;
    white-space: nowrap;
}

.role-name {
    font-size: 1rem;
    color: #d4c8a8;
}

.role-delete-btn {
    text-align: right;
}

/* ====================================================
   Timeline wrapper
==================================================== */

.timeline-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(1px);
    border-top: 1px solid rgba(160, 130, 60, 0.3);
}

#timeline {
    flex: 1;
    min-height: 400px;
}

/* ====================================================
   Vis.js dark theme overrides
==================================================== */

/* Main container */
.vis-timeline {
    background: transparent !important;
    border: none !important;
}

/* Background panels */
.vis-panel.vis-background,
.vis-panel.vis-center,
.vis-panel.vis-top,
.vis-panel.vis-bottom {
    background: transparent !important;
    border-color: rgba(160, 130, 60, 0.15) !important;
}

/* Left panel (group labels) */
.vis-panel.vis-left {
    background: rgba(8, 5, 2, 0.7) !important;
    border-right: 1px solid rgba(160, 130, 60, 0.3) !important;
}

/* Group label text */
.vis-label {
    color: #c8a864 !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    padding: 0 10px !important;
    background: transparent !important;
    border-bottom: 1px solid rgba(160, 130, 60, 0.1) !important;
    display: flex !important;
    align-items: center !important;
}

.vis-label .vis-inner {
    padding: 6px 0 !important;
}

/* Group rows */
.vis-panel.vis-center .vis-group {
    border-bottom: 1px solid rgba(160, 130, 60, 0.1) !important;
}

/* Time axis */
.vis-time-axis {
    background: rgba(8, 5, 2, 0.8) !important;
    border-bottom: 2px solid rgba(180, 148, 60, 0.5) !important;
}

.vis-time-axis .vis-text {
    color: #b8973a !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.03em !important;
}

.vis-time-axis .vis-text.vis-major {
    color: #d4a84a !important;
    font-size: 0.8rem !important;
}

/* Grid lines */
.vis-grid.vis-vertical {
    border-color: rgba(160, 130, 60, 0.08) !important;
}

.vis-grid.vis-vertical.vis-major {
    border-color: rgba(160, 130, 60, 0.18) !important;
}

/* The central axis line */
.vis-foreground .vis-group .vis-item-set {
    border-bottom: none !important;
}

/* ====================================================
   Event items
==================================================== */

.vis-item {
    background: rgba(12, 8, 4, 0.88) !important;
    border: 1px solid rgba(150, 118, 45, 0.55) !important;
    border-radius: 3px !important;
    color: #e8dcc8 !important;
    font-size: 0.8rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6), inset 0 1px 0 rgba(200,168,80,0.1) !important;
    cursor: pointer !important;
}

.vis-item:hover {
    border-color: rgba(210, 170, 60, 0.85) !important;
    background: rgba(25, 18, 8, 0.95) !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.8), 0 0 8px rgba(200,160,50,0.2) !important;
    z-index: 10 !important;
}

.vis-item.vis-selected {
    border-color: #c8a840 !important;
    background: rgba(30, 22, 8, 0.97) !important;
    box-shadow: 0 0 0 1px #c8a840, 0 4px 16px rgba(0,0,0,0.9) !important;
}

/* Item content */
.vis-item .vis-item-content {
    padding: 4px 8px !important;
    white-space: nowrap !important;
    color: #e8dcc8 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

/* Images inside items */
.vis-item img {
    height: 36px !important;
    width: auto !important;
    object-fit: contain !important;
    border-radius: 2px !important;
    opacity: 0.9;
}

/* Connector dot on axis */
.vis-item.vis-box .vis-item-overflow {
    overflow: visible !important;
}

.vis-item.vis-dot {
    border-color: #c8a840 !important;
}

/* Range items */
.vis-item.vis-range {
    background: rgba(12, 8, 4, 0.75) !important;
    border-color: rgba(150, 118, 45, 0.4) !important;
}

/* ====================================================
   Popup
==================================================== */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(14, 10, 4, 0.97);
    border: 1px solid rgba(160, 130, 55, 0.5);
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(100,80,30,0.2);
    max-width: 480px;
    width: 90%;
    display: none;
    z-index: 2001;
    color: #e8dcc8;
    overflow: hidden;
}

.popup-inner {
    padding: 24px;
}

.popup-inner h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    color: #f0e0b0;
    font-weight: 700;
}

.popup-date {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: #b8973a;
    font-weight: 600;
}

.popup-desc {
    margin: 0 0 16px;
    font-size: 0.9rem;
    color: #c8bca0;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

.popup-img {
    width: 100% !important;
    max-height: 320px !important;
    object-fit: contain !important;
    object-position: center top !important;
    border-radius: 4px !important;
    margin-bottom: 14px !important;
    display: block !important;
    float: none !important;
    background: #000 !important;
}

/* ====================================================
   Non-timeline pages (forms, home, etc.)
==================================================== */

.site-header {
    background: #1a1208;
    padding: 10px 24px;
    border-bottom: 1px solid rgba(160, 130, 60, 0.3);
}

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

.site-title {
    margin: 0;
    font-size: 1.4rem;
    color: #c8a864;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.site-header-auth {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.auth-username {
    font-size: 0.85rem;
    color: #a09060;
}

.auth-admin-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(160, 130, 60, 0.18);
    border: 1px solid rgba(160, 130, 60, 0.4);
    color: #b89040;
    padding: 1px 6px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
}

.site-main {
    padding: 24px;
    background:
        linear-gradient(rgba(12, 9, 4, 0.88), rgba(12, 9, 4, 0.88)),
        url('/static/images/bg_parchment.jpg') center / cover fixed;
    color: #d4c8a8;
    min-height: calc(100vh - 54px);
}

h2 {
    color: #c8a864;
}

label {
    color: #c8bca0;
}

input[type="text"],
textarea,
select {
    background: #1e1a0e;
    border: 1px solid rgba(160, 130, 60, 0.4);
    color: #e8dcc8;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 1.05rem;
}

button[type="submit"] {
    background: #5a3e18;
    color: #f0e0b0;
    border: 1px solid rgba(160,130,60,0.5);
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

button[type="submit"]:hover {
    background: #7a5520;
}

a {
    color: #b8973a;
}

a:hover {
    color: #d4b050;
}

/* Flash messages */
.flash-container {
    margin-bottom: 20px;
}

.flash {
    padding: 11px 16px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.92rem;
    border: 1px solid transparent;
    border-left-width: 4px;
    border-left-style: solid;
}

.flash-success {
    background: rgba(25, 50, 16, 0.85);
    border-color: rgba(60, 120, 40, 0.4);
    border-left-color: #5aaa3a;
    color: #90d070;
}

.flash-error {
    background: rgba(55, 12, 8, 0.85);
    border-color: rgba(140, 40, 30, 0.4);
    border-left-color: #c84a3a;
    color: #e07060;
}

/* ====================================================
   Add / Edit Event form layout
==================================================== */

.event-form-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
    flex-wrap: wrap;
}

.event-form-fields {
    flex: 0 0 360px;
    width: 360px;
}

.event-form-fields input[type="text"],
.event-form-fields select {
    width: 100%;
    box-sizing: border-box;
}

.event-form-description {
    flex: 0 0 50%;
    width: 50%;
    display: flex;
    flex-direction: column;
}

.event-form-description label {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.desc-textarea {
    width: 100%;
    min-height: 280px;
    box-sizing: border-box;
    resize: vertical;
    background: #1e1a0e;
    color: #d4c8a8;
    border: 1px solid rgba(160, 130, 60, 0.4);
    border-radius: 4px;
    padding: 10px;
    font-size: 1.05rem;
    font-family: inherit;
    line-height: 1.5;
}

/* ====================================================
   Map form preview (Add / Edit Event pages)
==================================================== */

.map-form-preview {
    margin-top: 14px;
    border-top: 1px solid rgba(160, 130, 60, 0.25);
    padding-top: 12px;
}

.map-preview-label {
    margin: 0 0 6px;
    font-size: 0.82rem;
    color: #a09060;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.map-preview-img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid rgba(160, 130, 60, 0.3);
    display: block;
}

/* ====================================================
   Map popup overlay (timeline view)
==================================================== */

.map-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 3000;
    backdrop-filter: blur(4px);
}

.map-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3001;
    max-width: 90vw;
    max-height: 88vh;
    outline: none;
    border: 1px solid rgba(160, 130, 60, 0.5);
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.95);
    overflow: hidden;
    background: #0a0806;
}

.map-popup-img {
    display: block;
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
}

.map-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(20, 14, 6, 0.88);
    border: 1px solid rgba(160, 130, 60, 0.5);
    color: #d4bc82;
    font-size: 1.4rem;
    line-height: 1;
    padding: 3px 10px 5px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.map-close-btn:hover {
    background: rgba(40, 30, 10, 0.95);
    border-color: rgba(200, 168, 75, 0.8);
    color: #f0d890;
}

.btn-map {
    border-color: rgba(60, 120, 160, 0.6);
    color: #80b8d8;
}

.btn-map:hover {
    background: rgba(10, 30, 60, 0.9);
    border-color: rgba(80, 160, 210, 0.8);
    color: #a8d0e8;
}

/* ====================================================
   Manage Assets page
==================================================== */

.assets-page {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: flex-start;
    max-width: 1100px;
}

.assets-section {
    flex: 1;
    min-width: 0;
}

.assets-section-title {
    color: #c8a864;
    font-size: 1.1rem;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(160, 130, 60, 0.3);
}

.asset-upload-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.asset-file-label input[type="file"] {
    color: #c8bca0;
    font-size: 0.9rem;
}

.assets-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.asset-card {
    background: rgba(20, 14, 6, 0.7);
    border: 1px solid rgba(160, 130, 60, 0.2);
    border-radius: 5px;
    padding: 6px 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.asset-card:hover {
    border-color: rgba(200, 168, 75, 0.5);
    background: rgba(30, 22, 8, 0.8);
}

.asset-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 3px;
    background: #0a0806;
    display: block;
    flex-shrink: 0;
}

.asset-name {
    font-size: 0.78rem;
    color: #9a8c70;
    text-align: left;
    word-break: break-all;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-card form {
    flex-shrink: 0;
}

.assets-empty {
    color: #7a6e58;
    font-style: italic;
    font-size: 0.9rem;
}

.assets-link-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: #7a6e58;
}

/* ====================================================
   Auth forms (login / setup)
==================================================== */

.auth-form-wrap {
    max-width: 380px;
    margin: 48px auto;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.auth-form label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
}

.auth-form button[type="submit"] {
    width: 100%;
    margin-top: 6px;
    padding: 10px;
    font-size: 1rem;
}

.home-login-hint {
    margin-top: 28px;
    font-size: 0.88rem;
    color: #7a6e58;
}

/* ====================================================
   Admin – user management
==================================================== */

.admin-users-page {
    max-width: 860px;
}

.admin-section {
    margin-bottom: 48px;
}

.admin-section-title {
    color: #c8a864;
    font-size: 1.05rem;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(160, 130, 60, 0.3);
}

.admin-add-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 560px;
}

.admin-add-fields {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.admin-add-fields > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.admin-add-fields input[type="text"],
.admin-add-fields input[type="password"] {
    width: 180px;
}

.admin-add-admin-check {
    padding-bottom: 6px;
}

.admin-add-admin-check label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: #c8bca0;
}

.user-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.user-card {
    background: rgba(20, 14, 6, 0.65);
    border: 1px solid rgba(160, 130, 60, 0.28);
    border-radius: 6px;
    padding: 18px 20px;
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.user-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #d4bc82;
}

.user-card-you {
    font-size: 0.8rem;
    color: #7a6e58;
    font-style: italic;
}

.user-perm-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-perm-admin label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: #c8bca0;
    font-size: 0.9rem;
}

.user-perm-label {
    margin: 0 0 6px;
    font-size: 0.8rem;
    color: #a09060;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-perm-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.user-perm-check-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #c8bca0;
    font-size: 0.88rem;
}

.user-perm-password label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #9a8c70;
}

.user-perm-password input[type="password"] {
    width: 220px;
    font-size: 0.92rem;
}
