/* ─── VIA Campus Map — style.css ─────────────────────────────────────────── */

/* ── DESIGN TOKENS ──────────────────────────────────────────────────────── */
:root {
    --via-blue:    #0057B7;
    --via-blue-d:  #003F8A;
    --via-blue-l:  #E8F0FF;
    --bg:          #F4F6FB;
    --surface:     #FFFFFF;
    --surface2:    #F0F3FA;
    --border:      #D8DEEE;
    --text:        #1A1F36;
    --text-soft:   #6B7394;
    --green:       #22C55E;
    --green-l:     #DCFCE7;
    --red:         #EF4444;
    --red-l:       #FEE2E2;
    --amber:       #F59E0B;
    --amber-l:     #FEF3C7;
    --purple:      #8B5CF6;
    --purple-l:    #EDE9FE;
    --header-h:    64px;
    --ribbon-h:    44px;
    --sidebar-w:   220px;
    --sidebar-r-w: 320px;
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 4px 24px rgba(0,40,120,.08);
    --shadow-lg:   0 12px 48px rgba(0,40,120,.15);
    --transition:  .18s cubic-bezier(.4,0,.2,1);
}

/* Dark mode */
[data-theme="dark"] {
    --bg:       #0F1117;
    --surface:  #1A1D2E;
    --surface2: #232639;
    --border:   #2D3256;
    --text:     #E8EAFF;
    --text-soft:#8B91C4;
    --via-blue-l: #1A2C50;
    --shadow:   0 4px 24px rgba(0,0,0,.4);
}

/* ── RESET & BASE ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    font-size: 14px;
    transition: background var(--transition), color var(--transition);
}
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select { font-family: inherit; }
::selection { background: var(--via-blue); color: #fff; }

/* ── FLOATING CONTROLS ───────────────────────────────────────────────────── */
/* Floating Floor Selector (Left Edge) */
.floating-floor-nav {
    position: fixed; left: 24px; top: 50%; transform: translateY(-50%);
    z-index: 10000; display: flex; flex-direction: column; gap: 8px;
    background: rgba(255,255,255,0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 8px; border-radius: 30px; border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
[data-theme="dark"] .floating-floor-nav { background: rgba(26, 29, 46, 0.85); }

.map-branding {
    position: fixed; left: 24px; top: 24px; z-index: 10000;
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 6px 16px 6px 6px; border-radius: 20px; border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06); color: var(--via-blue); font-size: 15px;
}
.map-branding img { width: 26px; height: 26px; border-radius: 8px; }
[data-theme="dark"] .map-branding { background: rgba(26, 29, 46, 0.85); color: #fff; }

.floor-btn {
    width: 44px; height: 44px;
    background: var(--surface2); border: none;
    border-radius: 12px; font-weight: 700; font-size: 13px;
    color: var(--text-soft); transition: var(--transition);
}
.floor-btn:hover { background: var(--via-blue-l); color: var(--via-blue); }
.floor-btn.active {
    background: var(--via-blue); color: #fff;
    box-shadow: 0 4px 12px rgba(0, 87, 183, 0.4);
}

/* Floating Action Bar (Bottom Center) */
.fab-bar {
    position: absolute; bottom: 30px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 12px;
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
    padding: 10px 14px; border-radius: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 50; border: 1px solid var(--border);
}
[data-theme="dark"] .fab-bar { background: rgba(26, 29, 46, 0.9); }

.fab-btn {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 20px; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.fab-btn:hover { transform: translateY(-4px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); border-color: var(--via-blue); }
.fab-btn.active { background: var(--via-blue-l); border-color: var(--via-blue); box-shadow: 0 0 0 2px var(--via-blue); }

/* Floating Directions Box */
.floating-dir-box {
    position: absolute; bottom: 90px; left: 50%;
    transform: translateX(-50%);
    background: var(--surface); width: 320px;
    padding: 16px; border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    z-index: 60; border: 1px solid var(--border);
    transition: var(--transition);
    opacity: 1; pointer-events: auto;
}
.floating-dir-box.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, 10px); }
.floating-dir-box h3 { margin-bottom: 12px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.floating-dir-box h3::before { content: '🧭'; }

.dir-form { display: flex; gap: 8px; }
.dir-form input {
    flex: 1; padding: 10px 14px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; color: var(--text);
    outline: none; transition: border-color 0.2s;
}
.dir-form input:focus { border-color: var(--via-blue); }
.dir-go-btn {
    background: var(--via-blue); color: #fff;
    padding: 0 16px; border-radius: 8px; font-weight: 700;
    transition: background 0.2s;
}
.dir-go-btn:hover { background: var(--via-blue-d); }

.dir-result {
    margin-top: 12px; padding: 12px;
    background: var(--via-blue-l); border-radius: 8px;
    font-size: 12px; line-height: 1.5; color: var(--via-blue-d);
}

/* ── MAIN LAYOUT ────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ── MAP AREA ───────────────────────────────────────────────────────────── */
.map-area {
    flex: 1; position: relative;
    overflow: hidden;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
}
.floor-label-badge {
    position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: 20px; padding: 6px 18px;
    font-size: 13px; font-weight: 600; z-index: 10;
    box-shadow: var(--shadow);
    pointer-events: none;
}
.map-wrapper {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
#floorSvg {
    width: 100%; height: 100%;
    /* Let SVG auto-scale to the wrapper naturally via viewBox */
    cursor: default;
    user-select: none;
}

/* SVG room shapes */
.room-shape {
    stroke: rgba(0,0,0,.25); stroke-width: 1.5;
    transition: opacity .15s ease, filter .15s ease;
    cursor: pointer;
}
.room-shape:hover {
    opacity: .85;
    filter: drop-shadow(0 0 6px rgba(0,87,183,.5));
}
.room-shape.available  { fill: var(--green);  stroke: #15803d; }
.room-shape.occupied   { fill: var(--red);    stroke: #b91c1c; }
.room-shape.facility   { fill: var(--amber);  stroke: #b45309; }
.room-shape.event      { fill: var(--purple); stroke: #6d28d9; }
.room-shape.path-highlight {
    stroke: var(--via-blue) !important;
    stroke-width: 3 !important;
    animation: pulse-border 1.2s infinite alternate;
}
@keyframes pulse-border {
    from { stroke-width: 2; stroke: var(--via-blue); }
    to   { stroke-width: 4; stroke: #66a3ff; }
}

/* Path line */
.nav-path {
    fill: none; stroke: var(--via-blue);
    stroke-width: 3.5; stroke-dasharray: 10 6;
    stroke-linecap: round; stroke-linejoin: round;
    animation: dash-move 1s linear infinite;
    opacity: .9;
}
@keyframes dash-move {
    to { stroke-dashoffset: -32; }
}

/* Quick-highlight pulse */
.room-shape.highlight-ping {
    animation: ping-glow 1.4s ease-out forwards;
}
@keyframes ping-glow {
    0%   { filter: drop-shadow(0 0 0px rgba(255,193,7,.9)); }
    60%  { filter: drop-shadow(0 0 18px rgba(255,193,7,.9)); opacity: .8; }
    100% { filter: none; }
}

/* Map tooltip */
.map-tooltip {
    position: fixed;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px; line-height: 1.5;
    box-shadow: var(--shadow-lg);
    pointer-events: none; z-index: 9999;
    max-width: 200px;
    transition: opacity .12s;
}
.map-tooltip.hidden { opacity: 0; pointer-events: none; }
.tooltip-name { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.tooltip-tag {
    display: inline-block; border-radius: 4px;
    padding: 1px 6px; font-size: 10px; font-weight: 600;
    margin-top: 3px;
}
.tooltip-tag.available { background: var(--green-l); color: #15803d; }
.tooltip-tag.occupied  { background: var(--red-l);   color: #b91c1c; }
.tooltip-tag.facility  { background: var(--amber-l); color: #92400e; }

/* Zoom controls */
.map-zoom-controls {
    position: absolute; bottom: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 4px;
}
.map-zoom-controls button {
    width: 36px; height: 36px;
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 18px; font-weight: 300;
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.map-zoom-controls button:hover { background: var(--via-blue-l); border-color: var(--via-blue); color: var(--via-blue); }

/* ── RIGHT SIDEBAR (Detail Panel) ───────────────────────────────────────── */
.sidebar-right {
    width: 0; overflow: hidden;
    background: var(--surface);
    border-left: 1px solid var(--border);
    transition: width .28s cubic-bezier(.4,0,.2,1);
    flex-shrink: 0; position: relative;
}
.sidebar-right.open {
    width: var(--sidebar-r-w);
}
.panel-close {
    position: absolute; top: 12px; right: 12px;
    background: var(--surface2); border: 1.5px solid var(--border);
    border-radius: 50%; width: 28px; height: 28px;
    font-size: 13px; color: var(--text-soft);
    display: flex; align-items: center; justify-content: center;
    z-index: 10; transition: var(--transition);
}
.panel-close:hover { background: var(--red-l); color: var(--red); border-color: var(--red); }

#panelContent { padding: 20px 16px; min-width: var(--sidebar-r-w); overflow-y: auto; max-height: 100%; }

/* Welcome state */
.panel-welcome { text-align: center; padding: 20px 0; }
.welcome-icon  { font-size: 48px; margin-bottom: 12px; }
.panel-welcome h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.panel-welcome p  { font-size: 13px; color: var(--text-soft); line-height: 1.5; }

.stats-row { display: flex; gap: 8px; margin-top: 20px; }
.stat-card {
    flex: 1; background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 8px; text-align: center;
}
.stat-num { font-size: 24px; font-weight: 800; color: var(--via-blue); }
.stat-lbl { font-size: 10px; color: var(--text-soft); margin-top: 2px; }

/* Panel header */
.panel-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.panel-room-name  { font-size: 18px; font-weight: 800; line-height: 1.2; }
.panel-room-sub   { font-size: 12px; color: var(--text-soft); }
.panel-status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
    margin-top: 6px; width: fit-content;
}
.panel-status-badge.available { background: var(--green-l); color: #15803d; }
.panel-status-badge.occupied  { background: var(--red-l);   color: #b91c1c; }
.panel-status-badge.facility  { background: var(--amber-l); color: #92400e; }
.panel-status-badge::before { content: '●'; font-size: 8px; }

/* Detail sections */
.detail-section { margin-bottom: 16px; }
.detail-section h4 { font-size: 11px; font-weight: 700; letter-spacing: .8px; color: var(--text-soft); text-transform: uppercase; margin-bottom: 8px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .key { color: var(--text-soft); }
.detail-row .val { font-weight: 600; }
.detail-row .val.yes { color: var(--green); }
.detail-row .val.no  { color: var(--red); }

/* Printers */
.printer-list    { display: flex; flex-direction: column; gap: 6px; }
.printer-card {
    background: var(--surface2); border-radius: var(--radius-sm);
    padding: 10px; border: 1px solid var(--border);
}
.printer-name  { font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.printer-status { font-size: 11px; }
.printer-status.free    { color: var(--green); }
.printer-status.busy    { color: var(--red);   }
.printer-progress { margin-top: 6px; height: 4px; background: var(--border); border-radius: 2px; }
.printer-bar { height: 100%; border-radius: 2px; background: var(--via-blue); transition: width 1s ease; }

/* Menu section */
.menu-category { margin-bottom: 12px; }
.menu-category h5 { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--text-soft); text-transform: uppercase; margin-bottom: 6px; }
.menu-item { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 12px; border-bottom: 1px dashed var(--border); }
.menu-item:last-child { border-bottom: none; }
.menu-price { font-weight: 700; color: var(--via-blue); }

/* Order button */
.order-btn {
    width: 100%; background: var(--via-blue); color: #fff;
    border-radius: var(--radius-sm); padding: 11px;
    font-size: 13px; font-weight: 700; margin-top: 12px;
    transition: var(--transition);
}
.order-btn:hover { background: var(--via-blue-d); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,87,183,.25); }

/* Reserve button */
.reserve-btn {
    width: 100%; background: var(--purple); color: #fff;
    border-radius: var(--radius-sm); padding: 11px;
    font-size: 13px; font-weight: 700; margin-top: 12px;
    transition: var(--transition);
}
.reserve-btn:hover { background: #7c3aed; transform: translateY(-1px); }

/* ── EVENTS MODAL ───────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn .15s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--surface); border-radius: 20px;
    width: 480px; max-height: 85vh;
    overflow-y: auto; padding: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: var(--surface2); border: 1.5px solid var(--border);
    border-radius: 50%; width: 32px; height: 32px;
    font-size: 14px; color: var(--text-soft);
}
.modal-close:hover { background: var(--red-l); color: var(--red); }
.modal-box h2 { font-size: 20px; font-weight: 800; margin-bottom: 16px; }

.events-list { display: flex; flex-direction: column; gap: 10px; }
.event-card {
    background: var(--surface2); border-radius: var(--radius);
    padding: 14px; border: 1px solid var(--border);
    transition: var(--transition);
}
.event-card:hover { border-color: var(--via-blue); transform: translateY(-1px); }
.event-date  { font-size: 11px; color: var(--text-soft); margin-bottom: 3px; font-weight: 500; }
.event-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.event-loc   { font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }
.event-tags  { display: flex; gap: 6px; flex-wrap: wrap; }

.tag { border-radius: 10px; padding: 2px 8px; font-size: 10px; font-weight: 600; }
.tag-open { background: var(--green-l); color: #15803d; }
.tag-club { background: var(--purple-l); color: #6d28d9; }
.tag-free { background: var(--via-blue-l); color: var(--via-blue); }

/* ── TOAST ──────────────────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--bg);
    border-radius: 30px; padding: 10px 22px;
    font-size: 13px; font-weight: 500;
    z-index: 9000; box-shadow: var(--shadow-lg);
    animation: toastIn .25s ease;
}
.toast.hidden { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ── SCROLLBARS ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── WELCOME SCREEN (FLOOR 0 HUB) ────────────────────────────────────────── */
.welcome-screen {
    position: fixed; inset: 0; z-index: 9000;
    display: grid;
    grid-template-columns: 55% 45%;  /* content gets slightly more width */
    transition: opacity 0.5s, visibility 0.5s;
    background: #F7F9FC;
}
.welcome-bg {
    width: 100%; height: 100%;
    object-fit: cover;           /* fill the column, crop at the top */
    object-position: center bottom; /* anchor to the bottom — shows base of building */
    background: #F0F4FA;        /* subtle background behind the transparent image */
    display: block;
}
.welcome-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* Left column — content */
.welcome-content {
    display: flex; flex-direction: column; justify-content: flex-start;
    padding: 0 40px 20px 120px;  /* no top padding — let the branding set the rhythm */
    padding-top: max(60px, 8vh); /* adaptive: 8% of viewport height */
    background: #F7F9FC;
    animation: slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}
@keyframes slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-branding { display: flex; flex-direction: row; align-items: center; gap: 12px; margin-bottom: 12px; }
.welcome-logo { width: 48px; height: 48px; border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.welcome-content h1 { font-size: 30px; font-weight: 900; color: var(--text); letter-spacing: -0.8px; margin: 0; line-height: 1.1; }
.welcome-subtitle { font-size: 14px; line-height: 1.5; color: var(--text-soft); margin: 8px 0 20px; font-weight: 400; }

.welcome-features {
    display: flex; flex-direction: column; gap: 8px;
}
.feat-card {
    background: #fff; border: 1.5px solid #E5EAF2;
    border-radius: 14px; padding: 14px 18px; display: flex; align-items: center; gap: 14px;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px; font-weight: 700; color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.feat-card:hover {
    border-color: var(--via-blue); transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 87, 183, 0.10);
}
.feat-card.primary {
    background: var(--via-blue); border-color: var(--via-blue);
    color: #fff; margin-bottom: 4px;
    box-shadow: 0 6px 16px rgba(0, 87, 183, 0.3);
}
.feat-card.primary:hover { background: var(--via-blue-d); transform: translateX(0) translateY(-2px); }

.feat-icon { font-size: 22px; }
.feat-text { flex-grow: 1; text-align: left; }
