:root { 
    --primary-color: #ef7d00; 
    --primary-hover: #cc6a00; 
    --accent-color: #111111; 
    --bg-color: #F8F9FA; 
    --card-bg: #FFFFFF; 
    --border-radius: 6px; 
    --font-family: 'Montserrat', sans-serif; 
    --hour-height: 120px; 
    --timeline-hours: 18; 
    --star-active-color: #FFC107;
    --star-inactive-color: #DADCE0;
}

svg { width: 14px; height: 14px; fill: currentColor; }
body { font-family: var(--font-family); background-color: var(--bg-color); margin: 0; padding: 10px; color: var(--accent-color); height: 100vh; height: 100dvh; display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden; font-size: 13px; }
*:focus-visible { outline: 2px solid #1A73E8 !important; outline-offset: 1px; }

/* Header & Toolbars */
.header { display: flex; flex-direction: column; background: var(--card-bg); padding: 10px 15px; border-radius: var(--border-radius); box-shadow: 0 2px 4px rgba(0,0,0,0.05); flex-shrink: 0; margin-bottom: 10px; gap: 10px; border: 1px solid #E0E0E0; }
.header-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.header-bottom { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #E0E0E0; padding-top: 10px; flex-wrap: wrap; gap: 10px; }
.header-bottom.collapsed .toolbar-right { display: none !important; }
#btn-toggle-header { display: none !important; }
.logo-container { display: flex; align-items: center; gap: 10px; }
.logo-container img { height: 32px; width: auto; display: block; }
.logo-container h2 { margin: 0; font-weight: 700; font-size: 1.1rem; color: var(--accent-color); border-left: 2px solid #E0E0E0; padding-left: 10px; display: inline-block; vertical-align: middle; }
.logo-container h2 span { white-space: nowrap; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { background-color: var(--primary-color); color: white; border: none; padding: 7px 14px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600; font-family: var(--font-family); transition: all 0.2s; display: flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { background-color: var(--primary-hover); transform: translateY(-1px); color: #FFFFFF !important; }
.btn:active { transform: translateY(0); }
.btn-gray { background-color: #5F6368; } .btn-gray:hover { background-color: #3C4043; }
.btn-blue { background-color: var(--primary-color); } .btn-blue:hover { background-color: var(--primary-hover); }

.view-switch { display: flex; gap: 0; background: #F1F3F4; border-radius: 4px; border: 1px solid #DADCE0; overflow: hidden; }
.btn-view { background: transparent; color: #5F6368; border: none; padding: 6px 12px; margin: 0; font-size: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; font-family: var(--font-family); }
.btn-view.active { background: #FFFFFF; color: var(--primary-color); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.btn-view:hover:not(.active) { background: #E8EAED; color: #111 !important; }

.day-tabs { display: flex; gap: 6px; }
.tab-btn { background: #F1F3F4; color: #111111; border: 1px solid #DADCE0; padding: 6px 16px; border-radius: 16px; cursor: pointer; font-weight: 600; font-size: 12px; transition: all 0.2s; }
.tab-btn:hover { background: #E8EAED; }
.tab-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.active-date-display { font-weight: 700; font-size: 13px; color: #111111; display: inline-block; vertical-align: middle; margin-right: 12px; }

.toolbar-right { display: flex; gap: 15px; align-items: center; }
.filter-container { display: flex; align-items: center; gap: 6px; position: relative; }
.filter-container label, .zoom-controls span { font-size: 12px; font-weight: 600; color: #111111; }
.filter-input, .filter-select { padding: 6px 10px; border-radius: 4px; border: 1px solid #70757A; font-family: var(--font-family); font-size: 12px; outline: none; color: #111; background-color: #FFF; box-sizing: border-box; }
.filter-input { width: 240px; }
.filter-select { width: 160px; cursor: pointer; }
.filter-input:focus, .filter-select:focus { border-color: #1A73E8; }

.multi-select-btn { width: 150px; text-align: left; background: #fff; padding: 6px 10px; border: 1px solid #70757A; border-radius: 4px; font-size: 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; align-items: center; }
.multi-select-dropdown { display: none; position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid #DADCE0; box-shadow: 0 4px 6px rgba(0,0,0,0.1); border-radius: 4px; padding: 10px; z-index: 2000; max-height: 300px; overflow-y: auto; width: max-content; margin-top: 4px; }
.multi-select-dropdown label { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; font-weight: 500; font-size: 12px; margin-bottom: 0; color: #111; }

.zoom-controls { display: flex; align-items: center; gap: 6px; background: #F1F3F4; padding: 4px; border-radius: 4px; border: 1px solid #DADCE0; }
.btn-zoom { background: white; border: 1px solid #DADCE0; border-radius: 4px; width: 24px; height: 24px; display: flex; justify-content: center; align-items: center; cursor: pointer; font-weight: bold; color: #111111; font-size: 14px;}
.btn-zoom:hover { background: #E8EAED; color: var(--primary-color); }

/* --- Board Container & Layout --- */
.board-container { display: flex; flex-direction: column; flex-grow: 1; overflow: auto; position: relative; background: #E8EAED; border-radius: var(--border-radius); box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); border: 1px solid #E0E0E0; user-select: none; }
.board-layout { display: flex; width: max-content; min-width: 100%; height: max-content; padding-bottom: 60px; position: relative; }

/* Zeitachse */
.time-axis { min-width: 55px; position: sticky; left: 0; background: #FFFFFF; z-index: 30; border-right: 2px solid #DADCE0; height: max-content; display: flex; flex-direction: column; }
.time-axis-content { position: relative; height: calc(var(--timeline-hours) * var(--hour-height)); width: 100%; }
.time-label { position: absolute; width: 100%; text-align: right; padding-right: 8px; transform: translateY(-50%); margin-top: 0; line-height: 1; box-sizing: border-box; color: #111111; z-index: 10; pointer-events: none; }
.time-label span { background: rgba(255,255,255,0.9); padding: 2px 4px; border-radius: 3px; }
.time-label.hour { font-size: 0.85em; font-weight: 800; color: #111; }
.time-label.quarter { font-size: 0.7em; font-weight: 600; color: #3C4043; } 

/* Board */
.board { display: flex; gap: 0; padding: 0; height: max-content; align-items: flex-start; }

.facility-line { position: absolute; left: 0; right: 0; height: 3px; z-index: 5; pointer-events: none; }
.time-axis-content .facility-line { z-index: 4; } 
.facility-line.open-line { background-color: #1E8E3E; }
.facility-line.close-line { background-color: #D32F2F; }
.facility-line .line-label { position: absolute; left: 55px; top: -7px; display: inline-block; color: white; font-weight: 700; font-size: 11px; padding: 3px 10px; border-bottom-right-radius: 6px; border-top-right-radius: 6px; white-space: nowrap; z-index: 35; }
.facility-line.open-line .line-label { background-color: #1E8E3E; }
.facility-line.close-line .line-label { background-color: #D32F2F; }

/* Raum-Styles */
.room { width: 240px; min-width: 240px; display: flex; flex-direction: column; border-right: 1px solid #E8EAED; background: #FFFFFF; height: max-content; position: relative; }
.room.collapsed { min-width: 50px; width: 50px; background: #E8EAED; height: auto; align-self: stretch; }

.room-header { padding: 8px 10px; background: #FFFFFF; display: flex; justify-content: space-between; align-items: flex-start; position: sticky; top: 0; z-index: 40; border-bottom: 2px solid var(--primary-color); box-shadow: 0 2px 4px rgba(0,0,0,0.03); height: 56px; box-sizing: border-box; width: 100%; }
.room.collapsed .room-header { flex-direction: column; padding: 6px 4px; height: 56px; align-items: center; justify-content: center; }

.room-title-container { flex-grow: 1; overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.room-title { color: #111; padding: 0 4px; border-radius: 4px; font-weight: 700; font-size: 0.95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.room-subtitle { color: #3C4043; padding: 0 4px; border-radius: 4px; font-weight: 600; font-size: 0.75em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.room-actions { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn { background: none; border: 1px solid transparent; color: #3C4043; cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--primary-color); background: #F1F3F4; border-color: #DADCE0; }

.collapsed-title { display: none; position: sticky; top: 70px; transform: rotate(180deg); writing-mode: vertical-rl; font-weight: 700; color: #3C4043; font-size: 0.85em; white-space: nowrap; z-index: 10; pointer-events: none; align-self: center; margin: 15px auto; }
.room.collapsed .room-title-container { display: none; }
.room.collapsed .room-actions { flex-direction: column; width: 100%; align-items: center; }
.room.collapsed .collapsed-title { display: block; }

.room-content { position: relative; height: calc(var(--timeline-hours) * var(--hour-height)); width: 100%; cursor: default; }
.room.collapsed .room-content { display: none; }

.grid-line { position: absolute; left: 0; width: 100%; pointer-events: none; box-sizing: border-box; }
.grid-line.quarter { border-bottom: 1px dashed #E2E8F0; }
.grid-line.hour { border-bottom: 2px solid #CBD5E1; } 

/* Events */
.event { padding: 8px 24px 8px 8px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.15); cursor: pointer; border-left: 4px solid; position: relative; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; overflow: hidden; transition: box-shadow 0.2s, filter 0.2s; z-index: 6; border-top: 1px solid rgba(0,0,0,0.05); border-right: 1px solid rgba(0,0,0,0.05); border-bottom: 1px solid rgba(0,0,0,0.05); color: #111; }
.event.cat-Ehrengaeste { background-color: rgba(149, 27, 129, 0.85); border-left-color: #951b81; color: #FFFFFF; }
.event.cat-Showacts { background-color: rgba(239, 125, 0, 0.85); border-left-color: #ef7d00; color: #FFFFFF; }
.event.cat-FanMeetup { background-color: rgba(239, 125, 0, 0.85); border-left-color: #ef7d00; color: #FFFFFF; } 
.event.cat-Vortraege { background-color: rgba(133, 188, 33, 0.85); border-left-color: #85bc21; color: #111111; }
.event.cat-ConnichiCouch { background-color: rgba(133, 188, 33, 0.85); border-left-color: #85bc21; color: #111111; } 
.event.cat-Japanforschung { background-color: rgba(133, 188, 33, 0.85); border-left-color: #85bc21; color: #111111; } 
.event.cat-Workshops { background-color: rgba(65, 192, 240, 0.85); border-left-color: #41c0f0; color: #111111; } 
.event.cat-Wettbewerbe { background-color: rgba(230, 0, 100, 0.85); border-left-color: #e60064; color: #FFFFFF; }
.event.cat-Rahmenprogramm { background-color: rgba(239, 125, 0, 0.85); border-left-color: #ef7d00; color: #FFFFFF; }
.event.cat-ohneBereich { background-color: rgba(230, 230, 230, 0.95); border-left-color: #5F6368; color: #111111; }

.event.is-canceled { opacity: 0.6; filter: grayscale(50%); }
.event.is-canceled span.text { text-decoration: line-through; opacity: 0.8; }
.event:hover { z-index: 12; box-shadow: 0 4px 8px rgba(0,0,0,0.2); filter: brightness(0.95); }

.timeline-room .event { position: absolute; width: calc(100% - 8px); left: 4px; }

.event-title { font-weight: 700; font-size: 0.85em; line-height: 1.2; display: flex; align-items: flex-start; gap: 5px; }
.event-title span.text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; width: calc(100% - 20px); }
.event-leader { font-size: 0.72em; opacity: 0.85; font-weight: 600; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-time { font-size: 0.72em; font-weight: 600; opacity: 0.95; white-space: nowrap; margin-top: auto;}
.event-image-preview { width: 100%; flex: 1; min-height: 0; height: auto; object-fit: cover; border-radius: 3px; margin-top: 4px; border: 1px solid rgba(0,0,0,0.1); pointer-events: none; }

/* Star Favoriting Buttons */
.btn-favorite-star {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: transparent;
    color: var(--star-inactive-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    padding: 0;
    z-index: 10;
}
.btn-favorite-star svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    stroke: rgba(0,0,0,0.2);
    stroke-width: 0.5px;
}
.btn-favorite-star:hover {
    color: var(--star-active-color);
    transform: scale(1.2);
}
.btn-favorite-star.is-fav {
    color: var(--star-active-color);
}
.btn-favorite-star.is-fav svg {
    stroke: none;
}

/* List View styles */
.list-container { display: flex; flex-direction: column; flex-grow: 1; overflow: auto; background: white; border-radius: var(--border-radius); box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid #E0E0E0; }
.event-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; table-layout: fixed; margin-bottom: 24px; }
.event-table th { position: sticky; top: 0; background: #FFFFFF; padding: 12px 10px; font-weight: 700; border-bottom: 2px solid var(--primary-color); z-index: 10; color: #111111; box-shadow: 0 2px 4px rgba(0,0,0,0.03); cursor: pointer; transition: background 0.2s; }
.event-table th:hover { background: #F8F9FA; }
.event-table th span.sort-icon { font-size: 10px; margin-left: 4px; color: #9AA0A6; }
.event-table td { padding: 8px 10px; border-bottom: 1px solid #E8EAED; vertical-align: middle; height: 48px; box-sizing: border-box; } 
.event-table tr:hover td { background: #F8F9FA; }

.event-table .btn-favorite-star {
    position: static;
    margin: 0 auto;
}

.btn-detail-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #F1F3F4;
    color: #5F6368;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-detail-view:hover {
    background: var(--primary-color);
    color: #FFF;
}
.btn-detail-view svg {
    width: 14px;
    height: 14px;
}

/* Modals */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); justify-content: center; align-items: center; z-index: 2000; }
.modal { background: #FFF; padding: 28px; border-radius: 8px; width: 620px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 15px 35px rgba(0,0,0,0.25); box-sizing: border-box; }

.modal-header-row { display: flex; justify-content: space-between; align-items: center; }
.modal-badge { padding: 4px 10px; border-radius: 12px; font-weight: 700; font-size: 11px; text-transform: uppercase; background: #E8EAED; color: #5F6368; }

/* Category styles on modal badge */
.cat-Ehrengaeste-badge { background: #80146e; color: white; }
.cat-Showacts-badge { background: #ef7d00; color: white; }
.cat-FanMeetup-badge { background: #ef7d00; color: white; }
.cat-Vortraege-badge { background: #85bc21; color: white; }
.cat-ConnichiCouch-badge { background: #85bc21; color: white; }
.cat-Japanforschung-badge { background: #85bc21; color: white; }
.cat-Workshops-badge { background: #41c0f0; color: white; }
.cat-Wettbewerbe-badge { background: #c50055; color: white; }
.cat-Rahmenprogramm-badge { background: #ef7d00; color: white; }
.cat-ohneBereich-badge { background: #4A4D50; color: white; }

.btn-close-modal { background: none; border: none; font-size: 28px; cursor: pointer; color: #9AA0A6; line-height: 1; padding: 0; transition: color 0.15s; }
.btn-close-modal:hover { color: #111; }

.event-meta-info-strip { display: flex; flex-wrap: wrap; gap: 15px 25px; background: #F8F9FA; padding: 12px 18px; border-radius: 6px; margin-bottom: 20px; border: 1px solid #E8EAED; }
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: #3C4043; }
.meta-val { font-size: 13px; font-weight: 600; color: #111; }

.modal-media-container { width: 100%; max-height: 280px; overflow: hidden; border-radius: 6px; margin-bottom: 20px; border: 1px solid #E8EAED; }
.modal-media-container img { width: 100%; height: 100%; object-fit: cover; }

.detail-group { margin-bottom: 18px; }
.detail-title { display: block; font-weight: 700; font-size: 11px; text-transform: uppercase; color: #3C4043; margin-bottom: 5px; letter-spacing: 0.5px; }
.detail-val { font-size: 14px; line-height: 1.6; color: #202124; }
.detail-val.font-semibold { font-weight: 600; color: #111; }
.detail-val.richtext { white-space: pre-wrap; }

.divider { height: 1px; background: #E8EAED; margin: 20px 0; }

/* Japanforschung */
.artist-bio-layout { display: flex; gap: 15px; align-items: flex-start; margin-top: 10px; }
.author-image-preview { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid #E8EAED; }
.artist-bio-text { flex: 1; }

/* Social media links */
.social-links-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.social-link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 4px; border: 1px solid #DADCE0; background: #FFF; color: #1557B0; font-weight: 600; text-decoration: none; font-size: 12px; transition: all 0.2s; }
.social-link-btn:hover { background: #F4F8FE; border-color: #1557B0; }

.modal-actions { display: flex; align-items: center; justify-content: flex-end; }

/* Favorites List Welcome message */
.no-favorites-msg {
    text-align: center;
    padding: 60px 20px;
    color: #5F6368;
}
.no-favorites-msg svg {
    width: 48px;
    height: 48px;
    color: var(--star-inactive-color);
    margin-bottom: 15px;
}
.no-favorites-msg h3 {
    margin: 0 0 8px 0;
    color: #111;
}

/* Event Cluster / Sammel-Kachel Styles */
.event-cluster {
    padding: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    cursor: default !important;
}
.cluster-header {
    font-weight: 700;
    font-size: 0.85em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    padding-bottom: 4px;
    margin-bottom: 2px;
    color: inherit;
}
.cluster-badge {
    background: rgba(0,0,0,0.15);
    padding: 1px 5px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 700;
}
.cluster-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
    flex-grow: 1;
}
.cluster-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    border-radius: 3px;
    border-left: 3px solid;
    background: rgba(255,255,255,0.7);
    color: #111;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.15s ease-in-out;
}
.cluster-item:hover {
    background: rgba(255,255,255,0.95);
}
.cluster-item-info {
    overflow: hidden;
    flex-grow: 1;
}
.cluster-item-title {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    width: 90%;
}
.cluster-item-time {
    opacity: 0.85;
    font-size: 0.9em;
}
.cluster-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.cluster-btn-edit {
    background: rgba(0, 0, 0, 0.08);
    border: none;
    color: inherit;
    cursor: pointer;
    border-radius: 2px;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}
.cluster-btn-edit:hover {
    background: rgba(0, 0, 0, 0.2);
}
.cluster-btn-edit svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
}

/* Print-only Header layout (hidden on screen) */
.print-only-header {
    display: none;
}

/* --- Print Styles --- */
@media print {
    @page {
        size: A4 landscape;
        margin: 5mm;
    }
    
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .print-only-header {
        display: block !important;
        text-align: center;
        margin-bottom: 10px;
        border-bottom: 2px solid var(--primary-color);
        padding-bottom: 5px;
    }
    .print-only-header h1 {
        font-size: 16px;
        margin: 0;
        font-weight: 800;
        color: var(--accent-color);
    }
    .print-only-header h2 {
        font-size: 12px;
        margin: 3px 0 0 0;
        font-weight: 600;
        color: #5F6368;
    }
    
    .header,
    .header-top,
    .header-bottom,
    .modal-overlay,
    .zoom-controls,
    .actions,
    .toolbar-right,
    .btn-favorite-star,
    .btn-detail-view,
    .icon-btn {
        display: none !important;
    }
    
    html, body {
        overflow: visible !important;
        height: auto !important;
        background: #FFFFFF !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .board-container {
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
        background: #FFFFFF !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .board-layout {
        width: 100% !important;
        max-width: 100% !important;
        height: calc(56px + var(--print-active-height, 1080px)) !important;
        padding-bottom: 0 !important;
        display: flex !important;
        overflow: hidden !important;
    }
    
    .time-axis-content,
    .room-content {
        transform: translateY(calc(-1 * var(--print-offset-y, 0px))) !important;
        height: var(--print-active-height, 1080px) !important;
    }
    
    .time-axis,
    .room {
        height: calc(56px + var(--print-active-height, 1080px)) !important;
        overflow: hidden !important;
    }
    
    .time-axis {
        position: relative !important;
        left: auto !important;
        border-right: 1px solid #DADCE0 !important;
        min-width: 50px !important;
        width: 50px !important;
    }
    
    .board {
        display: flex !important;
        flex-direction: row !important;
        flex-grow: 1 !important;
        width: calc(100% - 50px) !important;
        height: calc(56px + var(--print-active-height, 1080px)) !important;
    }
    
    .room.timeline-room {
        flex: 1 1 0% !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        border-right: 1px solid #DADCE0 !important;
        background: #FFFFFF !important;
    }
    
    .room.timeline-room.collapsed {
        flex: 0 0 35px !important;
        width: 35px !important;
        min-width: 35px !important;
        align-self: stretch !important;
    }
    
    .room-header {
        height: auto !important;
        min-height: 56px !important;
        padding: 4px 6px !important;
        box-sizing: border-box !important;
        position: relative !important;
        top: auto !important;
    }
    
    .room-title {
        white-space: normal !important;
        font-size: 10px !important;
        line-height: 1.2 !important;
    }
    
    .room-subtitle {
        white-space: normal !important;
        font-size: 8px !important;
        line-height: 1.1 !important;
    }
    
    .time-label {
        transform: none !important;
    }
    
    .event {
        padding: 4px 4px 4px 6px !important;
        box-shadow: none !important;
        border: 1px solid rgba(0,0,0,0.15) !important;
        border-left-width: 4px !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
    
    .event-title {
        font-size: 9px !important;
        line-height: 1.1 !important;
    }
    
    .event-title span.text {
        -webkit-line-clamp: unset !important;
        display: block !important;
        overflow: visible !important;
    }
    
    .event-leader {
        font-size: 8px !important;
        padding-left: 0 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
    
    .event-time {
        font-size: 8px !important;
    }
    
    .event-image-preview {
        max-height: 60px !important;
        margin-top: 2px !important;
    }
}

@media screen and (max-width: 768px) {
    /* Hide placeholder on mobile to keep layout clean */
    #sidebar-placeholder {
        display: none !important;
    }
    .logo-container {
        width: 100% !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .logo-container img {
        height: 24px !important;
    }
    .logo-container h2 {
        font-size: 18px !important;
        border-left: 2px solid #E0E0E0 !important;
        padding-left: 10px !important;
        margin-top: 0 !important;
        line-height: 24px !important;
    }
    .header-top {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .actions {
        justify-content: center !important;
        gap: 6px !important;
    }
    .header-bottom {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .header-bottom > div {
        justify-content: center !important;
    }
    .toolbar-right {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 10px !important;
    }
    .zoom-controls {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: 4px;
    }
    .filter-container {
        justify-content: space-between !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .filter-container label {
        width: 65px;
        flex-shrink: 0;
    }
    .filter-input,
    .multi-select-btn,
    .filter-select {
        flex-grow: 1 !important;
        width: auto !important;
        max-width: none !important;
    }
    .day-tabs-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
        width: 100% !important;
    }
    .day-tabs {
        display: flex !important;
        width: 100% !important;
        justify-content: center !important;
    }
    .day-tabs .tab-btn {
        flex: 1 !important;
        text-align: center !important;
        padding: 6px 2px !important;
        font-size: 11px !important;
    }
}

@media screen and (max-width: 600px) {
    .modal {
        width: 100% !important;
        max-width: calc(100% - 24px) !important;
        max-height: 80dvh !important; /* Cap height to leave space at bottom of screen */
        padding: 16px !important;
        margin: 12px !important;
        box-sizing: border-box !important;
    }
    .multi-select-dropdown {
        width: calc(100vw - 32px) !important;
        max-width: 320px !important;
        left: 0 !important;
        right: 0 !important;
    }
    .modal-actions {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }
    .modal-actions .btn,
    .modal-actions button {
        width: 100% !important;
        justify-content: center !important;
        margin-right: 0 !important;
    }
}

.favorites-warning-banner {
    display: flex;
    align-items: center;
    background: #FFF8E1;
    border: 1px solid #FFC107;
    border-radius: var(--border-radius);
    padding: 10px 15px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #8f6d00;
    font-weight: 500;
    line-height: 1.4;
}

.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
    max-width: 380px;
    width: calc(100vw - 40px);
}
.toast {
    background: var(--card-bg);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border-top: 1px solid #E8EAED;
    border-right: 1px solid #E8EAED;
    border-bottom: 1px solid #E8EAED;
    position: relative;
    box-sizing: border-box;
}
@keyframes toastSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--primary-color);
    letter-spacing: 0.5px;
}
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #9AA0A6;
    line-height: 1;
    padding: 0;
    margin-left: auto;
}
.toast-close:hover {
    color: #111;
}
.toast-body {
    font-size: 13px;
    font-weight: 600;
    color: #202124;
    line-height: 1.4;
}
.toast-meta {
    font-size: 11px;
    color: #5F6368;
}
.toast-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}
.toast-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
    letter-spacing: 0.5px;
}
.toast-btn:hover {
    text-decoration: underline;
}

.day-tabs-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.event-table tbody tr:hover {
    background-color: #F8F9FA;
}

.app-footer {
    margin-top: auto;
    padding: 12px 20px;
    border-top: 1px solid #E2E8F0;
    background-color: #F8F9FA;
    text-align: center;
    font-size: 11px;
    color: #5F6368;
    box-sizing: border-box;
    position: sticky;
    left: 0;
    width: calc(100vw - 22px);
    z-index: 35;
    will-change: transform;
    transform: translateZ(0);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.footer-separator {
    color: #CBD5E1;
}

.footer-copy {
    font-size: 11px;
    opacity: 0.8;
}

/* Responsive Table layout for mobile */
@media screen and (max-width: 768px) {
    .mobile-sort-container {
        display: flex !important;
    }
    #btn-toggle-header {
        display: inline-flex !important;
        height: 44px !important;
        box-sizing: border-box !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
    .btn-view {
        height: 44px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 15px !important;
    }
    .btn-view svg {
        width: 16px !important;
        height: 16px !important;
    }
    .event-table, 
    .event-table tbody {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    .event-table thead {
        display: none !important;
    }
    .event-table tr:not(.empty-row) {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
        position: relative;
        padding: 12px 12px 12px 45px !important;
        margin-bottom: 12px;
        background: #FFFFFF;
        border-radius: var(--border-radius);
        border: 1px solid #E8EAED !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    .event-table tr:not(.empty-row) td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
        padding: 3px 0 !important;
        height: auto !important;
        border-bottom: none !important;
        text-align: left !important;
    }
    
    .event-table tr.empty-row {
        display: block !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .event-table tr.empty-row td {
        display: block !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
        padding: 20px 0 !important;
    }
    
    /* Star Favorite Icon on absolute left */
    .event-table tr:not(.empty-row) td:nth-child(1) {
        position: absolute;
        left: 10px;
        top: 12px;
        width: 30px !important;
    }
    
    /* Title */
    .event-table tr:not(.empty-row) td:nth-child(2) {
        font-size: 14px;
        font-weight: 700;
        padding-right: 35px !important;
    }
    
    /* Day & Time */
    .event-table tr:not(.empty-row) td:nth-child(3) {
        display: inline-block !important;
        width: auto !important;
        margin-right: 8px;
        font-size: 12px;
        color: var(--primary-color);
    }
    .event-table tr:not(.empty-row) td:nth-child(4) {
        display: inline-block !important;
        width: auto !important;
        font-size: 12px;
        color: #5F6368;
    }
    
    /* Room */
    .event-table tr:not(.empty-row) td:nth-child(5) {
        font-size: 12px;
        color: #202124;
        font-weight: 600;
    }
    .event-table tr:not(.empty-row) td:nth-child(5)::before {
        content: "Raum: ";
        font-weight: 400;
        color: #5F6368;
    }
    
    /* Leader */
    .event-table tr:not(.empty-row) td:nth-child(6) {
        font-size: 12px;
        color: #202124;
    }
    .event-table tr:not(.empty-row) td:nth-child(6)::before {
        content: "Leitung: ";
        font-weight: 400;
        color: #5F6368;
    }
    
    /* Category Badge */
    .event-table tr:not(.empty-row) td:nth-child(7) {
        margin-top: 4px;
    }
    
    /* Details Button on absolute top right */
    .event-table tr:not(.empty-row) td:nth-child(8) {
        position: absolute;
        right: 10px;
        top: 10px;
        width: 30px !important;
    }
}

/* PWA Install Banner Stiling */
.pwa-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 1050;
    max-width: 90%;
    width: 450px;
    box-sizing: border-box;
    border-left: 4px solid var(--primary-color);
    font-family: var(--font-family);
}
.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pwa-icon {
    width: 20px;
    height: 20px;
    fill: var(--primary-color);
    flex-shrink: 0;
}
.pwa-text-container {
    display: flex;
    flex-direction: column;
}
.pwa-title {
    font-weight: 700;
    font-size: 13px;
    color: #111;
}
.pwa-desc {
    font-size: 11px;
    color: #5F6368;
    line-height: 1.3;
}
.pwa-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-close-pwa {
    background: none;
    border: none;
    font-size: 20px;
    color: #9AA0A6;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
.btn-close-pwa:hover {
    color: #111;
}
.btn-sm {
    padding: 5px 10px !important;
    font-size: 11px !important;
}

@media screen and (max-width: 600px) {
    .pwa-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        bottom: 10px;
    }
    .pwa-actions {
        justify-content: flex-end;
    }
}

/* DYNAMIC SVG GELÄNDEKARTE BILDERSTILE */
.svg-room {
    cursor: pointer;
    stroke-width: 2;
    transition: fill-opacity 0.25s, stroke-width 0.2s;
}

.svg-room:hover {
    fill-opacity: 0.45 !important;
    stroke-width: 3.5;
}

.svg-room.no-click {
    cursor: default !important;
}

.svg-room.no-click:hover {
    fill-opacity: 0.25 !important;
    stroke-width: 2 !important;
}

/* Raum Belegungsfarben */
.svg-room.cat-Ehrengaeste { fill: #951b81 !important; fill-opacity: 0.25; }
.svg-room.cat-Showacts { fill: #ef7d00 !important; fill-opacity: 0.25; }
.svg-room.cat-FanMeetup { fill: #ef7d00 !important; fill-opacity: 0.25; }
.svg-room.cat-Vortraege { fill: #85bc21 !important; fill-opacity: 0.25; }
.svg-room.cat-ConnichiCouch { fill: #85bc21 !important; fill-opacity: 0.25; }
.svg-room.cat-Japanforschung { fill: #85bc21 !important; fill-opacity: 0.25; }
.svg-room.cat-Workshops { fill: #41c0f0 !important; fill-opacity: 0.25; }
.svg-room.cat-Wettbewerbe { fill: #e60064 !important; fill-opacity: 0.25; }
.svg-room.cat-Rahmenprogramm { fill: #ef7d00 !important; fill-opacity: 0.25; }
.svg-room.cat-ohneBereich { fill: #5F6368 !important; fill-opacity: 0.25; }
.svg-room.cat-free { fill: #cbd5e1 !important; fill-opacity: 0.12; }

/* Händlerstände */
.svg-booth {
    fill: #f59e0b;
    fill-opacity: 0.8;
    stroke: #b45309;
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill-opacity 0.2s, stroke-width 0.2s;
}

.svg-booth:hover {
    fill-opacity: 0.95;
}

.svg-booth.selected {
    fill: #3b82f6 !important;
    stroke: #1d4ed8 !important;
    fill-opacity: 0.95;
}

/* Such-Hervorhebung für Stände (Premium Neon Glow) */
.svg-booth.search-highlight {
    stroke: #dc2626 !important;
    stroke-width: 3.5 !important;
    animation: search-pulse-glow 1.5s infinite;
}

@keyframes search-pulse-glow {
    0% { filter: drop-shadow(0 0 2px rgba(220, 38, 38, 0.4)); }
    50% { filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.9)); }
    100% { filter: drop-shadow(0 0 2px rgba(220, 38, 38, 0.4)); }
}

/* Architektonische Wände & Türen */
.svg-wall {
    stroke: #475569;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.door-leaf {
    stroke: #475569;
    stroke-width: 2.5;
    stroke-linecap: round;
    fill: none;
}

.door-arc {
    stroke: #475569;
    stroke-width: 1.2;
    stroke-dasharray: 2.5 2.5;
    fill: none;
}

.door-clickbox {
    fill: transparent;
    cursor: pointer;
}

/* Glassmorphe Hover-Card */
.map-hover-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(209, 213, 219, 0.3);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 14px 16px;
    min-width: 230px;
    max-width: 280px;
    font-family: inherit;
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #0f172a;
}

.map-hover-card h4 {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    color: #ef7d00;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-hover-card .active-event {
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
    line-height: 1.4;
}

.map-hover-card .event-time {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

.map-hover-card .next-event {
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    margin-top: 4px;
    padding-top: 6px;
    font-size: 11px;
    color: #64748b;
}

.map-hover-card .progress-bar-bg {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    width: 100%;
    overflow: hidden;
    margin-top: 4px;
}

.map-hover-card .progress-bar-fill {
    height: 100%;
    background: #1e63ef;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s;
}

/* Pulsierendes Highlight bei Raumsuche/Wegweiser */
.svg-room.locate-highlight {
    stroke: #1e63ef !important;
    stroke-width: 5 !important;
    fill-opacity: 0.5 !important;
    animation: room-locate-pulse 1.2s infinite;
}

@keyframes room-locate-pulse {
    0% { filter: drop-shadow(0 0 2px rgba(30, 99, 239, 0.4)); }
    50% { filter: drop-shadow(0 0 10px rgba(30, 99, 239, 0.8)); }
    100% { filter: drop-shadow(0 0 2px rgba(30, 99, 239, 0.4)); }
}

/* Mobile-Optimierungen für die Navigation und Karte */
@media screen and (max-width: 600px) {
    /* Text ausblenden, damit 4 Buttons nebeneinander passen */
    .btn-view span {
        display: none;
    }
    .btn-view {
        padding: 10px 18px !important;
        height: 44px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .btn-view svg {
        width: 18px !important;
        height: 18px !important;
    }
    #btn-toggle-header {
        height: 44px !important;
        box-sizing: border-box !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
}

@media screen and (max-width: 768px) {
    /* Kartenlayout untereinander stapeln */
    .map-container {
        height: auto !important;
        flex-grow: 1 !important;
        margin-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .map-view-layout {
        flex-direction: column !important;
        overflow: hidden !important; /* Scroll-Konflikte verhindern */
        height: calc(100% - 60px) !important;
    }
    .map-workspace {
        padding: 0 !important;
        height: auto !important; /* Verbleibende Höhe ausfüllen */
        flex-grow: 1 !important;
    }
    .map-workspace > div:first-child {
        padding: 12px 15px 0 15px !important;
        box-sizing: border-box !important;
    }
    #floor-select-mobile {
        height: 32px !important;
        box-sizing: border-box !important;
        padding: 4px 10px !important;
        font-size: 13px !important;
    }
    #btn-place-marker {
        height: 32px !important;
        width: 32px !important;
        box-sizing: border-box !important;
    }
    .zoom-controls {
        height: 32px !important;
        box-sizing: border-box !important;
        padding: 2px !important;
    }
    .zoom-controls .btn-zoom {
        height: 26px !important;
        width: 26px !important;
        line-height: 26px !important;
        padding: 0 !important;
    }
    .canvas-wrapper {
        border-radius: 0 !important;
        border: none !important;
        height: 100% !important;
    }
    .booth-info-sidebar {
        width: 100% !important;
        border-left: none !important;
        border-top: 1px solid #cbd5e1 !important;
        padding: 0 !important;
        height: auto !important;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05) !important;
        flex-grow: 0 !important;
        transition: max-height 0.25s ease-in-out;
        max-height: 70vh !important; /* Expand up to 70% of screen height to fit search results */
        overflow-y: auto !important; /* Enable scrolling for the drawer container */
    }
    .sidebar-inner-content {
        padding: 15px;
        display: flex;
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
        max-height: none !important; /* Remove nested constraint */
        overflow-y: visible !important; /* Let outer sidebar container handle scrolling */
    }
    #sidebar-search-results {
        max-height: none !important; /* Remove inner scroll area to prevent cut-offs */
        overflow-y: visible !important;
    }
    .booth-info-sidebar.collapsed {
        max-height: 44px !important;
        flex-grow: 0 !important;
        overflow: hidden !important; /* Keep toggler visible, hide inner content when collapsed */
    }
    .sidebar-mobile-toggle {
        display: flex !important;
        user-select: none;
    }
    
    /* Ebenenwähler als Dropdown auf Mobile */
    .floor-selector-desktop {
        display: none !important;
    }
    .floor-selector-mobile {
        display: block !important;
    }

    /* Kompaktere Steuerungselemente auf Mobile */
    .map-workspace .tab-btn {
        padding: 4px 10px !important;
        font-size: 11px !important;
    }
    .map-workspace .zoom-controls {
        padding: 2px !important;
        gap: 2px !important;
    }
    .map-workspace .btn-zoom {
        width: 22px !important;
        height: 22px !important;
        font-size: 12px !important;
    }
    #map-zoom-label {
        font-size: 11px !important;
        min-width: 38px !important;
        padding: 0 4px !important;
    }
}


/* Stairs & Tree styles */
.svg-stairs {
    fill: #f8fafc;
    stroke: #64748b;
    stroke-width: 1.5px;
}
.svg-stairs-step {
    stroke: #94a3b8;
    stroke-width: 1px;
}
.svg-tree {
    fill: #bbf7d0;
    fill-opacity: 0.6;
    stroke: #22c55e;
    stroke-width: 1.5px;
}
.svg-tree-trunk {
    fill: #16a34a;
    stroke: #16a34a;
    stroke-width: 1px;
}
.svg-tree-leaf {
    fill: #86efac;
    fill-opacity: 0.3;
    stroke: #16a34a;
    stroke-width: 1px;
}

/* WC & Lift styles */
.svg-wc {
    fill: #e0f2fe;
    stroke: #0284c7;
    stroke-width: 1.5px;
}
.svg-lift {
    fill: #f1f5f9;
    stroke: #475569;
    stroke-width: 1.5px;
}

/* ==========================================
   NEW NAVIGATION & MOBILE APP-STYLE UX OVERRIDES
   ========================================== */

/* 1. Mobile Bottom Navigation Bar (app-like view switcher) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    display: none; /* Hidden on desktop */
    justify-content: space-around;
    align-items: center;
    z-index: 1040; /* Above board and sidebar, but below drawer */
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #64748b;
    font-family: var(--font-family);
    font-weight: 700;
    font-size: 10px;
    gap: 4px;
    padding: 0;
    position: relative;
    transition: color 0.15s ease;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item.active svg {
    transform: translateY(-2px) scale(1.08);
}

/* Active tab top indicator line */
.nav-item::after {
    content: '';
    position: absolute;
    top: 0;
    width: 24px;
    height: 3px;
    background-color: transparent;
    border-radius: 0 0 4px 4px;
    transition: background-color 0.15s ease;
}

.nav-item.active::after {
    background-color: var(--primary-color);
}

/* 2. Filter Drawer Overlay Backdrop (Mobile) */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1050;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

body.filter-open .filter-overlay {
    display: block;
    opacity: 1;
}

/* 3. Mobile Viewport Adjustments (<= 768px) */
@media screen and (max-width: 768px) {
    /* Hide top view switcher to avoid duplicates & overflow */
    .header-top .actions .view-switch {
        display: none !important;
    }
    
    /* Show bottom navigation bar */
    .bottom-nav {
        display: flex !important;
    }

    body {
        padding: 0 !important;
    }

    .header {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        margin-bottom: 0 !important;
    }

    /* Lock body scrolling when drawer is open */
    body.filter-open {
        overflow: hidden !important;
    }

    /* Adjust page containers to not clip under bottom navigation and add side padding */
    .board-container {
        padding-left: 0 !important;
        padding-right: 10px !important;
        padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box;
    }
    .list-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box;
    }

    .app-footer {
        margin-bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Make the Day Selector horizontal pills centered & scrollable if they overflow */
    .day-tabs-container {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin-top: 5px;
    }

    .day-tabs {
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        width: auto !important;
        max-width: 100% !important;
        justify-content: center !important;
        gap: 8px !important;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .day-tabs::-webkit-scrollbar {
        display: none;
    }

    .day-tabs .tab-btn {
        flex: 0 0 auto !important;
        padding: 8px 18px !important;
        font-size: 12px !important;
        border-radius: 20px !important;
        font-weight: 700 !important;
    }

    .active-date-display {
        font-size: 12px !important;
        font-weight: 700 !important;
        color: var(--primary-color) !important;
        white-space: nowrap;
        flex-shrink: 0;
        margin-right: 8px !important;
        display: inline-block !important;
    }

    /* Redesign header-bottom as a sliding bottom sheet drawer - set to open further up (90dvh) */
    .header-bottom {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: #FFFFFF !important;
        border-top: 1px solid rgba(226, 232, 240, 0.9) !important;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.15) !important;
        padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px)) 20px !important;
        margin: 0 !important;
        z-index: 1060 !important; /* On top of everything including bottom-nav (1040) and overlay (1050) */
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important; /* overrides display: none */
        max-height: 90dvh !important;
        overflow-y: auto !important;
    }

    /* Slide drawer in when filter is active (i.e. not collapsed) */
    .header-bottom:not(.collapsed) {
        transform: translateY(0) !important;
    }

    /* Style the internal drawer container */
    .toolbar-right {
        display: flex !important; /* override collapse hide */
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        width: 100% !important;
    }

    .filter-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .filter-container label {
        font-size: 11px !important;
        font-weight: 800 !important;
        color: #64748b !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        text-align: left !important;
    }

    .filter-input, 
    .filter-select,
    .multi-select-btn {
        width: 100% !important;
        height: 42px !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        border: 2px solid #e2e8f0 !important;
        background-color: #FFFFFF !important;
        box-sizing: border-box !important;
        font-weight: 600 !important;
    }

    .multi-select-btn::after {
        content: "▼";
        font-size: 8px;
        color: #64748b;
    }

    .multi-select-dropdown {
        position: static !important;
        box-shadow: none !important;
        border: 2px solid #e2e8f0 !important;
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
        margin-top: 8px !important;
        max-height: 250px !important;
        z-index: auto !important;
    }

    /* Hide the top filter button on mobile since we have it in the bottom App Bar */
    #btn-toggle-header {
        display: none !important;
    }

    /* Style the PWA banner above bottom navigation */
    .pwa-banner {
        bottom: calc(75px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    /* Style toast container above bottom navigation */
    .toast-container {
        bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
        top: auto !important;
    }
}

/* Desktop Grid Layout: Align Day tabs on the left and Filters on the right on the same row */
@media screen and (min-width: 769px) {
    .header {
        display: grid !important;
        grid-template-columns: auto 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 10px 15px !important;
    }
    .header-top {
        grid-column: 1 / span 2 !important;
        grid-row: 1 !important;
    }
    .day-tabs-container {
        grid-column: 1 !important;
        grid-row: 2 !important;
        align-self: center !important;
    }
    .header-bottom {
        grid-column: 2 !important;
        grid-row: 2 !important;
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        justify-content: flex-end !important;
        align-self: center !important;
    }
}

/* Hide mobile-only button on desktop */
.mobile-only-cta {
    display: none !important;
}

/* Style mobile-only button inside the drawer on mobile */
@media screen and (max-width: 768px) {
    .mobile-only-cta {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        height: 44px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        margin-top: 15px !important;
        box-sizing: border-box !important;
        background-color: var(--primary-color) !important;
        color: white !important;
        border: none !important;
    }
    .mobile-only-cta:hover {
        background-color: var(--primary-hover) !important;
    }
}

/* Bottom Nav Divider & Badge Styling */
.nav-divider {
    display: none; /* Hidden on desktop */
}

@media screen and (max-width: 768px) {
    .nav-divider {
        display: block !important;
        width: 1px !important;
        height: 28px !important;
        background-color: #cbd5e1 !important;
        align-self: center !important;
        opacity: 0.8 !important;
        margin: 0 4px !important;
        flex-shrink: 0 !important;
    }
}

.filter-badge {
    animation: badge-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-pop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}
