/* ==========================================
   Reset & Base
   ========================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    background: var(--color-bg);
    font-family: var(--font-family);
    color: var(--color-text);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

::-webkit-scrollbar {
    display: none;
}

* {
    scrollbar-width: none;
}

/* ==========================================
   Header
   ========================================== */

.kiosk-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
    z-index: 100;
}

.building-name {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.header-time {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-light);
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ==========================================
   Search
   ========================================== */

.search-container {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    padding: var(--space-lg) var(--content-padding);
    background: rgba(15, 17, 23, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 90;
}

.search-icon {
    position: absolute;
    left: calc(var(--content-padding) + 20px);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: var(--search-height);
    font-size: var(--font-size-lg);
    font-family: var(--font-family);
    background: var(--color-bg-input);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0 var(--space-xl) 0 60px;
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(79, 143, 255, 0.15);
}

.search-input::placeholder {
    color: var(--color-text-muted);
}

/* ==========================================
   Tenant List
   ========================================== */

.tenant-list {
    position: absolute;
    top: calc(var(--header-height) + var(--search-height) + var(--space-lg) * 2);
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: var(--space-md) var(--content-padding) calc(var(--space-3xl) * 2);
}

/* ==========================================
   Tenant Row
   ========================================== */

.tenant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--row-height);
    background: var(--color-bg-card);
    margin-bottom: var(--row-gap);
    padding: 0 var(--space-xl);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast), border-left-color var(--transition-fast);
    border-left: 4px solid transparent;
}

.tenant-row:active {
    background: var(--color-bg-card-hover);
    transform: scale(0.99);
    border-left-color: var(--color-primary);
}

.tenant-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: var(--space-md);
}

.tenant-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.tenant-floor {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-floor-badge);
    background: rgba(16, 185, 129, 0.12);
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.tenant-room {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-room-badge);
    min-width: 80px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ==========================================
   No Results
   ========================================== */

.no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: var(--space-3xl);
    color: var(--color-text-muted);
    gap: var(--space-lg);
}

.no-results.visible {
    display: flex;
}

.no-results p {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
}

/* ==========================================
   Map Overlay
   ========================================== */

.map-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-overlay);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.map-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================
   Map Panel
   ========================================== */

.map-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--map-panel-height);
    background: var(--color-bg-secondary);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    transform: translateY(100%);
    transition: transform var(--transition-map);
    z-index: 1000;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
}

.map-panel.active {
    transform: translateY(0);
}

.map-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl) var(--content-padding);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.map-panel-title {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.map-panel-tenant-name {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}

.map-panel-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.map-panel-floor {
    color: var(--color-floor-badge);
    font-weight: var(--font-weight-medium);
}

.map-panel-room {
    color: var(--color-room-badge);
    font-weight: var(--font-weight-semibold);
}

.map-close-btn {
    width: 60px;
    height: 60px;
    min-width: 60px;
    border-radius: 50%;
    background: var(--color-bg-card);
    color: var(--color-text);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.map-close-btn:active {
    background: var(--color-bg-card-hover);
}

/* ==========================================
   Map Container
   ========================================== */

.map-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.map-container svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

/* ==========================================
   Route Drawing & Animation
   ========================================== */

.route-path {
    stroke: var(--map-route-color);
    stroke-width: var(--map-route-width);
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawRoute 1.5s ease forwards 0.3s;
}

@keyframes drawRoute {
    to {
        stroke-dashoffset: 0;
    }
}

.route-marker-start {
    fill: var(--map-start-color);
}

.route-marker-end {
    fill: var(--map-end-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        r: 12;
        opacity: 1;
    }
    50% {
        r: 18;
        opacity: 0.7;
    }
}

/* ==========================================
   Alphabet Quick Nav
   ========================================== */

.alpha-nav {
    position: fixed;
    right: 6px;
    top: calc(var(--header-height) + var(--search-height) + var(--space-lg) * 2 + var(--space-md));
    bottom: var(--space-xl);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    z-index: 80;
    padding: var(--space-xs) 0;
}

.alpha-nav-letter {
    font-size: 0.7rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.alpha-nav-letter:active {
    color: var(--color-primary);
    background: rgba(79, 143, 255, 0.12);
}
