/* =============================================
   Kronikos – Front Page
   AdminLTE overrides + Map layout + UI components
   ============================================= */

/* -- Layout: full-height map app --------------- */

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-wrapper {
    flex: 1;
    min-height: 0 !important;
    position: relative;
    overflow: hidden;
    margin-left: 0 !important;
}

/* -- Navbar ------------------------------------ */

#main-navbar {
    background: #2c1810 !important;
    border-bottom: 1px solid rgba(196, 163, 90, 0.3);
    flex-shrink: 0;
    z-index: 200;
}

#main-navbar .navbar-brand .brand-text {
    color: #c4a35a;
    font-size: 18px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#main-navbar .nav-link {
    color: #d4c9a8 !important;
    transition: color 0.2s;
}

#main-navbar .nav-link:hover {
    color: #f0e6c0 !important;
}

#main-navbar .dropdown-menu {
    background: #1a1510;
    border: 1px solid rgba(196, 163, 90, 0.3);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

#main-navbar .dropdown-item {
    color: #d4c9a8;
    padding: 8px 16px;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

#main-navbar .dropdown-item:hover,
#main-navbar .dropdown-item.active {
    background: rgba(196, 163, 90, 0.2);
    color: #f0e6c0;
}

#main-navbar .navbar-toggler {
    border-color: rgba(196, 163, 90, 0.3);
}

/* -- Map --------------------------------------- */

#map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 110px;
    z-index: 1;
}

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

/* -- Event markers ----------------------------- */

.event-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
}

.event-marker:hover {
    transform: scale(1.3);
}

.event-marker-point              { background: #3498db; }
.event-marker-period             { background: #9b59b6; }
.event-marker-battle             { background: #c0392b; }
.event-marker-construction       { background: #27ae60; }
.event-marker-territory_change   { background: #e67e22; }

/* -- Event popup ------------------------------- */

#event-popup {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 24, 16, 0.94);
    backdrop-filter: blur(10px);
    color: #e8dcc0;
    padding: 16px 20px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    z-index: 60;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#popup-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #a89878;
    font-size: 20px;
    cursor: pointer;
}

#popup-title {
    font-size: 16px;
    color: #c4a35a;
    margin-bottom: 4px;
    padding-right: 24px;
}

#popup-date {
    display: block;
    font-size: 12px;
    color: #a89878;
    margin-bottom: 8px;
}

#popup-summary {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* -- Filter panel ------------------------------ */

.filters-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 240px;
    background: rgba(30, 24, 16, 0.92);
    backdrop-filter: blur(8px);
    color: #d4c9a8;
    padding: 16px;
    z-index: 50;
    overflow-y: auto;
    max-height: 100%;
    border-bottom-left-radius: 8px;
    transition: transform 0.3s;
}

.filters-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.filters-panel-header h3 {
    font-size: 15px;
    color: #c4a35a;
    margin: 0;
}

.filters-panel-close {
    background: none;
    border: none;
    color: #d4c9a8;
    font-size: 20px;
    cursor: pointer;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    cursor: pointer;
}

.filter-item input[type="checkbox"] {
    accent-color: #c4a35a;
}

.filter-empty {
    font-size: 13px;
    opacity: 0.6;
}

/* -- Buttons ----------------------------------- */

.btn-kronikos {
    background: #8b6914;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
    display: inline-block;
}

.btn-kronikos:hover {
    background: #a07a1a;
    color: #fff;
}

.btn-kronikos.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* -- Comment & auth form button overrides ------- */

#new-comment-form .btn-kronikos {
    margin-top: 8px;
}

.auth-form .btn-kronikos {
    padding: 10px;
}

/* -- Footer ------------------------------------ */

#main-footer {
    background: #1a1510 !important;
    color: #a89878;
    border-top: 1px solid rgba(196, 163, 90, 0.2) !important;
    padding: 6px 16px !important;
    flex-shrink: 0;
    font-size: 13px;
}

#main-footer strong {
    color: #c4a35a;
}

.footer-right {
    color: #6b5a48;
    font-size: 12px;
}

/* -- Control sidebar (comments panel) ---------- */

.control-sidebar {
    background: rgba(26, 21, 16, 0.97) !important;
    width: 350px !important;
    top: 0 !important;
    border-left: 1px solid rgba(196, 163, 90, 0.2);
}

.sidebar-comments-inner {
    padding: 16px;
}

.sidebar-comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(196, 163, 90, 0.15);
}

.sidebar-comments-header h5 {
    color: #c4a35a;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.sidebar-back-btn {
    background: none;
    border: 1px solid rgba(196, 163, 90, 0.3);
    color: #d4c9a8;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.2s;
}

.sidebar-back-btn:hover {
    background: rgba(196, 163, 90, 0.15);
}

.sidebar-comment {
    padding: 10px 0;
    border-bottom: 1px solid rgba(196, 163, 90, 0.1);
}

.sidebar-comment:last-child {
    border-bottom: none;
}

.sidebar-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.sidebar-comment-header strong {
    color: #c4a35a;
    font-size: 13px;
}

.sidebar-comment-header time {
    color: #6b5a48;
    font-size: 11px;
}

.sidebar-comment-event {
    display: block;
    color: #8b6914;
    font-size: 12px;
    margin-bottom: 4px;
    text-decoration: none;
}

.sidebar-comment-event:hover {
    color: #c4a35a;
    text-decoration: underline;
}

.sidebar-comment p {
    color: #d4c9a8;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.sidebar-empty {
    color: #6b5a48;
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

.sidebar-comment-textarea {
    width: 100%;
    border: 1px solid rgba(196, 163, 90, 0.3);
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    background: rgba(255, 255, 255, 0.05);
    color: #e8dcc0;
}

.sidebar-comment-textarea:focus {
    outline: none;
    border-color: #c4a35a;
}

.sidebar-login-hint {
    font-size: 13px;
    color: #6b5a48;
    padding: 10px 0;
}

.sidebar-login-hint a {
    color: #c4a35a;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 16px;
}

/* -- Utilities --------------------------------- */

.hidden {
    display: none !important;
}

.loading {
    color: #a89878;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* -- Responsive -------------------------------- */

@media (max-width: 768px) {
    #map-container {
        bottom: 90px;
    }

    .control-sidebar {
        width: 300px !important;
    }

    #event-popup {
        max-width: none;
        width: calc(100% - 20px);
        bottom: 10px;
        border-radius: 8px;
    }

    .filters-panel {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .control-sidebar {
        width: 100% !important;
    }

    #popup-title {
        font-size: 14px;
    }

    #popup-summary {
        font-size: 12px;
    }

    .event-marker {
        width: 12px;
        height: 12px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    #map-container {
        bottom: 70px;
    }
}

@media (pointer: coarse) {
    .event-marker {
        width: 18px;
        height: 18px;
    }

    .filter-item {
        padding: 8px 0;
    }

    #popup-more {
        padding: 10px 22px;
    }
}
