@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Poppins:wght@600;800&display=swap');

/* --- MODERN CSS VARIABLES --- */
:root {
    --bg-body: #050810;
    --bg-container: #0b1121;
    --room-base: rgba(30, 41, 59, 0.4);
    --room-stroke: #334155;
    --room-hover: rgba(56, 189, 248, 0.1);
    --room-hover-stroke: #38bdf8;
    --room-active: rgba(56, 189, 248, 0.25);
    --room-active-stroke: #0ea5e9;
    --text-base: #94a3b8;
    --text-highlight: #ffffff;
    --accent-indigo: #818cf8;
    --panel-border: rgba(148, 163, 184, 0.18);
}

* {
    box-sizing: border-box;
}

/* Enable normal page scrolling */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at center, #111827 0%, var(--bg-body) 100%);
    display: flex;
    flex-direction: column;
    color: white;
}

/* --- HEADER SECTION --- */
.header {
    text-align: center;
    padding: 20px 10px 10px 10px;
    flex-shrink: 0;
}

/* --- Floor navigation bar --- */
.floor-switcher {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 20px 14px;
}

.floor-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 50px;
    background: var(--room-base);
    border: 1px solid var(--room-stroke);
    color: var(--text-base);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, transform 0.2s ease;
}

.floor-switch-btn:hover {
    border-color: var(--room-hover-stroke);
    color: var(--text-highlight);
    transform: translateY(-2px);
}

.floor-switch-btn:focus-visible {
    border-color: var(--room-hover-stroke);
    color: var(--text-highlight);
    transform: translateY(-2px);
    outline: 2px solid var(--room-hover-stroke);
    outline-offset: 2px;
}

.floor-switch-btn.is-current {
    background: rgba(14, 165, 233, 0.15);
    border-color: var(--room-active-stroke);
    color: var(--text-highlight);
}

.floor-switch-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.15);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-highlight);
}

.floor-switch-btn.is-current .floor-switch-badge {
    background: var(--room-active-stroke);
    color: #04121f;
}

h1 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(24px, 3vw, 48px);
    margin: 0 0 5px 0;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

p.subtitle {
    color: var(--text-base);
    margin: 0;
    font-size: clamp(12px, 1.2vw, 20px);
    font-weight: 400;
}

/* --- STRICTLY BOUNDED CONTAINER --- */
#plan-container {
    flex: 1 1 auto;
    width: 100%;
    padding: 10px 20px 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.plan-svg-wrap {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Magic scaling SVG bounded by the container */
svg {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
}

/* --- ROOM STYLES & TRANSITIONS --- */
.room {
    fill: var(--room-base);
    stroke: var(--room-stroke);
    stroke-width: 2;
    stroke-linejoin: round;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.room-group:hover .room {
    fill: var(--room-hover);
    stroke: var(--room-hover-stroke);
    stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.3));
}

.room-group:hover text {
    fill: var(--text-highlight);
}

.room-group.active .room {
    fill: var(--room-active);
    stroke: var(--room-active-stroke);
    stroke-width: 4;
    filter: drop-shadow(0 0 12px rgba(14, 165, 233, 0.5));
}

.room-group.active text {
    fill: var(--text-highlight);
    font-weight: 600;
}

/* --- TYPOGRAPHY INSIDE SVG --- */
text {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    fill: var(--text-base);
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: middle;
    transition: fill 0.3s ease;
}

.bold {
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.5px;
}

.small-text {
    font-size: 11px;
}

/* --- ANIMATED PULSE INDICATOR --- */
.indicator-group {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.room-group.active .indicator-group {
    visibility: visible;
    opacity: 1;
}

.pulse-ring {
    transform-origin: center;
    animation: radar-pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes radar-pulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
        stroke-width: 4px;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
        stroke-width: 1px;
    }
}

/* --- Cluster highlight for a whole clinical unit (e.g. all Room 03 spaces) --- */
.room-group.cluster-highlight .room {
    stroke: var(--accent-indigo);
    stroke-width: 3;
    filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.6));
}

.room-group.cluster-highlight text {
    fill: var(--text-highlight);
}

/* --- Info Panel --- */
.info-panel {
    flex: 0 0 300px;
    max-width: 320px;
    min-height: 0;
    overflow-y: auto;
    background: var(--bg-container);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-panel-title {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-highlight);
    opacity: 0.85;
    margin: 0 0 12px;
}

.room-status {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: 12px;
    padding: 14px 16px;
}

.room-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--room-active-stroke);
    box-shadow: 0 0 10px var(--room-active-stroke);
    flex-shrink: 0;
    animation: radar-pulse-dot 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes radar-pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.room-status-label {
    display: block;
    font-size: 11px;
    color: var(--text-base);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.room-status-name {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-highlight);
    font-size: 16px;
    line-height: 1.3;
}

.room-status-code {
    display: block;
    font-size: 12px;
    color: var(--room-active-stroke);
    margin-top: 2px;
}

.facility-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.facility-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-base);
    font-size: 13px;
}

.facility-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--room-hover-stroke);
    box-shadow: 0 0 6px var(--room-hover-stroke);
    flex-shrink: 0;
}

/* Custom Scrollbar for Info Panel */
.info-panel::-webkit-scrollbar {
    width: 6px;
}
.info-panel::-webkit-scrollbar-track {
    background: transparent;
}
.info-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.floor-room-card {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
    padding: 10px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: all 0.25s ease;
}

.floor-room-card:last-child {
    margin-bottom: 0;
}

.floor-room-card:focus-visible {
    outline: 1px dashed var(--accent-indigo);
    outline-offset: 2px;
}

.floor-room-card.is-highlighted {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.1) 0%, transparent 100%);
    border-left-color: var(--accent-indigo);
}

.floor-room-number {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-indigo);
    margin-bottom: 4px;
}

.floor-room-name {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-highlight);
    font-size: 14px;
    margin-bottom: 4px;
}

.floor-room-detail {
    display: block;
    color: var(--text-base);
    font-size: 12px;
    line-height: 1.4;
}

/* --- Responsive fallback for narrow screens (this dashboard is designed for a large kiosk/lobby display) --- */
@media (max-width: 900px) {
    html, body {
        height: auto;
        min-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }

    #plan-container {
        flex-direction: column;
        height: auto;
    }

    .plan-svg-wrap {
        width: 100%;
        height: 50vh;
        min-height: 320px;
    }

    .info-panel {
        flex: none;
        width: 100%;
        max-width: 100%;
        height: auto;
    }
}/* --- BOTTOM INFO DECK --- */
.bottom-info-deck {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.deck-section {
    background: var(--bg-container);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 24px 30px;
}

.deck-title {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-highlight);
    opacity: 0.85;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.deck-title i {
    color: var(--accent-gold);
}

.facility-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.facility-pills li {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-base);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.facility-pills li:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-highlight);
}

.clinical-units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* Redesigned floor-room-card to fit grid cleanly */
.floor-room-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid transparent;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: all 0.25s ease;
}

.floor-room-card:focus-visible {
    outline: 1px dashed var(--accent-indigo);
    outline-offset: 2px;
}

.floor-room-card.is-highlighted {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.1) 0%, transparent 100%);
    border-left-color: var(--accent-indigo);
    border-top-color: rgba(14, 165, 233, 0.2);
    border-right-color: rgba(14, 165, 233, 0.05);
    border-bottom-color: rgba(14, 165, 233, 0.2);
}
