@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    /* Premium Color Palette */
    --bg-primary: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --bg-accent: #E9ECEF;

    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-accent: #6B7280;

    --brand-primary: #111827;
    /* Deep Black/Charcoal */
    --brand-secondary: #374151;

    --accent-color: #2563EB;
    /* Refined Blue */

    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* Disable pinch-to-zoom on touchы terminals while allowing scroll */
    touch-action: pan-x pan-y;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Inter', sans-serif;
    /* Keep it clean, maybe Playfair for special headers if needed */
    letter-spacing: -0.025em;
}

.font-serif {
    font-family: 'Playfair Display', serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

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

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out forwards;
}

.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

/* Glassmorphism Utilities */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Interactive Elements */
button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:active {
    transform: scale(0.98);
}

.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

/* Input Styles */
.input-premium {
    background: var(--bg-secondary);
    border: 1px solid #E5E7EB;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.input-premium:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.05);
    outline: none;
}

/* Card Styles */
.card-premium {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* --- 3D Map Styles --- */
:root {
    /* --- ЦВЕТА СТЕН (БОК / ВЕРХ) --- */
    /* Нейтральные (Внешний контур и перегородки) */
    --w-neutral-side: #9eaab5;
    --w-neutral-top: #ffffff;

    /* Голубые (Universal/Musical) */
    --w-blue-side: #90caf9;
    --w-blue-top: #e3f2fd;

    /* Розовые (Babies/Childrens) */
    --w-pink-side: #ef9a9a;
    --w-pink-top: #ffebee;

    /* Желтый (Reading) */
    --w-yellow-side: #e6ee9c;
    --w-yellow-top: #fff9c4;

    /* Бежевый (Teens - бывшее Служебное) */
    --w-beige-side: #ffcc80;
    --w-beige-top: #fff3e0;
}

/* --- 3D WALL STYLES --- */
.wall-side {
    stroke-width: 0.5px;
    pointer-events: none;
}

.wall-top {
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1px;
    pointer-events: none;
}

/* CSS Classes mapped from JS */
.wall-neutral .wall-side {
    fill: var(--w-neutral-side);
    stroke: var(--w-neutral-side);
}

.wall-neutral .wall-top {
    fill: var(--w-neutral-top);
}

.wall-blue .wall-side {
    fill: var(--w-blue-side);
    stroke: var(--w-blue-side);
}

.wall-blue .wall-top {
    fill: var(--w-blue-top);
}

.wall-pink .wall-side {
    fill: var(--w-pink-side);
    stroke: var(--w-pink-side);
}

.wall-pink .wall-top {
    fill: var(--w-pink-top);
}

.wall-purple .wall-side {
    fill: var(--w-purple-side);
    stroke: var(--w-purple-side);
}

.wall-purple .wall-top {
    fill: var(--w-purple-top);
}

.wall-yellow .wall-side {
    fill: var(--w-yellow-side);
    stroke: var(--w-yellow-side);
}

.wall-yellow .wall-top {
    fill: var(--w-yellow-top);
}

.wall-beige .wall-side {
    fill: var(--w-beige-side);
    stroke: var(--w-beige-side);
}

.wall-beige .wall-top {
    fill: var(--w-beige-top);
}

/* --- ZONES --- */
.zone {
    cursor: pointer;
    transition: fill 0.3s ease;
}

.zone:hover {
    opacity: 0.8;
}

/* --- HIGHLIGHT ANIMATION --- */
.highlighted {
    fill: #ff3b30 !important;
    stroke: #ff0000 !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 10px rgba(255, 59, 48, 0.8));
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.7;
    }
}

/* --- MODAL PAGE LAYOUT --- */
.modal-backdrop-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.6);
    /* Bluish-gray backdrop */
    backdrop-filter: blur(4px);
    z-index: 40;
    animation: fadeIn 0.3s ease-out;
}

.modal-page-wrapper {
    position: relative;
    width: 92%;
    max-width: 1400px;
    height: 85vh;
    margin: 12vh auto 0;
    /* Push down from top */
    background-color: #ffffff;
    border-radius: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    /* Hide overflow here, let inner content scroll */
    z-index: 50;
    padding: 0;
    /* Remove padding for edge-to-edge look */
    display: flex;
    flex-direction: column;
    animation: slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.global-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: #f3f4f6;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 60;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.global-close-btn:hover {
    background-color: #e5e7eb;
    color: #111827;
    transform: rotate(90deg);
}

/* --- MAP DIMMING & LABELS --- */
.map-dimmed .zone:not(.highlighted) {
    fill: #f3f4f6 !important;
    opacity: 0.5;
}

.map-dimmed .wall-side,
.map-dimmed .wall-top {
    fill: #e5e7eb !important;
    stroke: #d1d5db !important;
    transition: all 0.3s ease;
}

/* Keep highlighted walls colored */
.map-dimmed .wall-group.highlighted .wall-side {
    fill: #ff3b30 !important;
    stroke: #cc0000 !important;
}

.map-dimmed .wall-group.highlighted .wall-top {
    fill: #ff8a80 !important;
}

.wall-group.highlighted .wall-side {
    fill: #ff3b30 !important;
    stroke: #cc0000 !important;
}

.wall-group.highlighted .wall-top {
    fill: #ff8a80 !important;
}

.map-dimmed .floor-decor {
    fill: #e5e7eb !important;
    opacity: 0.5;
    transition: all 0.3s ease;
}

/* Floor Buttons Active State */
.floor-btn.active {
    background-color: #111827 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.floor-btn {
    padding-top: 0.6rem;
    /* Optical adjustment */
    padding-bottom: 0.6rem;
}

/* Map Labels */
.map-label {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    fill: #111827;
    /* Dark text */
    text-anchor: middle;
    pointer-events: none;
    dominant-baseline: middle;
}

.map-label-bg {
    fill: #ffffff !important;
    stroke: #e5e7eb;
    stroke-width: 1px;
    rx: 12px;
    /* Fully rounded pill shape */
    ry: 12px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    opacity: 0.95;
}