/**
 * Building Plan Styles
 *
 * Стили для шаблона "План здания"
 * Дизайн как на skakovaya17.ru:
 * - Оранжевый фон (#FAA73B) - шапка блока плана
 * - Серый (#74746E) - занятые офисы
 * - Прозрачный/светлый - свободные офисы
 * - Оранжевая подсветка при hover
 *
 * @package skakovaya_theme
 */

/* ==========================================================================
   Основные переменные
   ========================================================================== */

:root {
    --bp-primary: #FAA73B;
    --bp-primary-hover: #E89528;
    --bp-leased: #74746E;
    --bp-leased-hover: #5A5A55;
    --bp-free: #E8F5E9;
    --bp-free-border: #4CAF50;
    --bp-free-hover: #C8E6C9;
    --bp-text-dark: #333333;
    --bp-text-light: #666666;
    --bp-bg-light: #F5F5F5;
    --bp-border: #E0E0E0;
    --bp-white: #FFFFFF;
    --bp-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --bp-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --bp-transition: all 0.3s ease;
}

/* ==========================================================================
   Секция плана здания
   ========================================================================== */

.building-plan-section {
    padding: 40px 0 60px;
    background: var(--bp-bg-light);
}

.building-plan-section .page-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 30px;
}

/* ==========================================================================
   Wrapper и основная структура
   ========================================================================== */

.building-plan-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

@media (max-width: 991px) {
    .building-plan-wrapper {
        flex-direction: column;
    }
}

/* ==========================================================================
   Панель с этажами (левая колонка)
   ========================================================================== */

.floor-tabs-panel {
    flex: 0 0 180px;
    background: var(--bp-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--bp-shadow);
}

@media (max-width: 991px) {
    .floor-tabs-panel {
        flex: none;
        width: 100%;
    }
}

.floor-tabs-header {
    background: var(--bp-primary);
    color: var(--bp-white);
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.floor-tabs {
    display: flex;
    flex-direction: column;
}

@media (max-width: 991px) {
    .floor-tabs {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.floor-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 15px 20px;
    border: none;
    background: var(--bp-white);
    cursor: pointer;
    transition: var(--bp-transition);
    border-bottom: 1px solid var(--bp-border);
    text-align: left;
    width: 100%;
}

@media (max-width: 991px) {
    .floor-tab {
        flex: 1 1 auto;
        min-width: 120px;
        border-bottom: none;
        border-right: 1px solid var(--bp-border);
        text-align: center;
        align-items: center;
    }
    
    .floor-tab:last-child {
        border-right: none;
    }
}

.floor-tab:last-child {
    border-bottom: none;
}

.floor-tab:hover {
    background: var(--bp-bg-light);
}

.floor-tab.active {
    background: var(--bp-primary);
    color: var(--bp-white);
    border-bottom-color: var(--bp-primary);
}

.floor-tab-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.floor-tab-info {
    font-size: 12px;
    color: var(--bp-text-light);
}

.floor-tab.active .floor-tab-info {
    color: rgba(255, 255, 255, 0.85);
}

.floor-tab-info .free-count {
    font-weight: 700;
    color: var(--bp-free-border);
    margin-right: 3px;
}

.floor-tab.active .floor-tab-info .free-count {
    color: var(--bp-white);
}

/* ==========================================================================
   Контейнер плана этажа (центральная часть)
   ========================================================================== */

.floor-plan-container {
    flex: 1;
    min-width: 0;
}

.floor-content-block {
    display: none;
    background: var(--bp-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--bp-shadow);
}

.floor-content-block.active {
    display: block;
}

.floor-plan-header {
    background: var(--bp-primary);
    color: var(--bp-white);
    padding: 15px 25px;
}

.floor-plan-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.floor-plan-body {
    display: flex;
    gap: 20px;
    padding: 20px;
}

@media (max-width: 767px) {
    .floor-plan-body {
        flex-direction: column;
    }
}

/* ==========================================================================
   SVG контейнер
   ========================================================================== */

.floor-svg-container {
    flex: 1;
    min-width: 0;
    background: var(--bp-bg-light);
    border-radius: 6px;
    padding: 15px;
    overflow: hidden;
}

.svg-wrapper {
    width: 100%;
    overflow: auto;
}

.svg-wrapper svg {
    width: 100%;
    height: auto;
    max-height: 600px;
}

.svg-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--bp-text-light);
    font-style: italic;
}

/* ==========================================================================
   SVG офисы
   ========================================================================== */

.svg-wrapper .office,
.svg-wrapper a.office,
.svg-wrapper [class*="office"] {
    cursor: default;
    transition: var(--bp-transition);
    text-decoration: none;
}

.svg-wrapper .office.free,
.svg-wrapper a.office.free,
.svg-wrapper [class*="office"].free,
.svg-wrapper a[class*="office"] {
    cursor: pointer;
}

.svg-wrapper .office.free:hover,
.svg-wrapper .office.free.office-hover,
.svg-wrapper .office.free.table-highlight,
.svg-wrapper a[class*="office"]:hover,
.svg-wrapper [class*="office"].free:hover,
.svg-wrapper [class*="office"].free.office-hover,
.svg-wrapper [class*="office"].free.table-highlight {
    opacity: 0.85;
}

.svg-wrapper .office.free polygon,
.svg-wrapper .office.free path,
.svg-wrapper .office.free rect,
.svg-wrapper a[class*="office"] polygon,
.svg-wrapper [class*="office"].free polygon,
.svg-wrapper [class*="office"].free path,
.svg-wrapper [class*="office"].free rect {
    fill: var(--bp-free);
    stroke: var(--bp-free-border);
    stroke-width: 2;
    transition: var(--bp-transition);
}

.svg-wrapper .office.free:hover polygon,
.svg-wrapper .office.free:hover path,
.svg-wrapper .office.free:hover rect,
.svg-wrapper .office.free.office-hover polygon,
.svg-wrapper .office.free.office-hover path,
.svg-wrapper .office.free.office-hover rect,
.svg-wrapper .office.free.table-highlight polygon,
.svg-wrapper .office.free.table-highlight path,
.svg-wrapper .office.free.table-highlight rect,
.svg-wrapper a[class*="office"]:hover polygon,
.svg-wrapper a[class*="office"]:hover path,
.svg-wrapper a[class*="office"]:hover rect,
.svg-wrapper [class*="office"].free:hover polygon,
.svg-wrapper [class*="office"].free:hover path,
.svg-wrapper [class*="office"].free:hover rect,
.svg-wrapper [class*="office"].free.office-hover polygon,
.svg-wrapper [class*="office"].free.office-hover path,
.svg-wrapper [class*="office"].free.office-hover rect,
.svg-wrapper [class*="office"].free.table-highlight polygon,
.svg-wrapper [class*="office"].free.table-highlight path,
.svg-wrapper [class*="office"].free.table-highlight rect {
    fill: var(--bp-primary);
    stroke: var(--bp-primary-hover);
}

.svg-wrapper .office.leased polygon,
.svg-wrapper .office.leased path,
.svg-wrapper .office.leased rect,
.svg-wrapper [class*="office"].leased polygon,
.svg-wrapper [class*="office"].leased path,
.svg-wrapper [class*="office"].leased rect {
    fill: var(--bp-leased);
    stroke: var(--bp-leased-hover);
    stroke-width: 1;
}

.svg-wrapper .office.leased:hover polygon,
.svg-wrapper .office.leased:hover path,
.svg-wrapper .office.leased:hover rect,
.svg-wrapper [class*="office"].leased:hover polygon,
.svg-wrapper [class*="office"].leased:hover path,
.svg-wrapper [class*="office"].leased:hover rect {
    fill: var(--bp-leased-hover);
}

/* Текст внутри офисов */
.svg-wrapper .office text,
.svg-wrapper [class*="office"] text {
    font-size: 12px;
    font-weight: 600;
    fill: var(--bp-text-dark);
    pointer-events: none;
}

.svg-wrapper .office.leased text,
.svg-wrapper [class*="office"].leased text {
    fill: var(--bp-white);
}

.svg-wrapper .office text tspan,
.svg-wrapper [class*="office"] text tspan {
    font-size: 10px;
    font-weight: 400;
}

/* ==========================================================================
   Панель статистики (правая колонка)
   ========================================================================== */

.floor-stats-panel {
    flex: 0 0 200px;
}

@media (max-width: 767px) {
    .floor-stats-panel {
        flex: none;
        width: 100%;
    }
}

.floor-stats {
    background: var(--bp-bg-light);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--bp-border);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 13px;
    color: var(--bp-text-light);
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--bp-text-dark);
}

.stat-item.stat-free .stat-value {
    color: var(--bp-free-border);
}

.stat-item.stat-leased .stat-value {
    color: var(--bp-leased);
}

/* ==========================================================================
   Легенда
   ========================================================================== */

.floor-legend {
    background: var(--bp-bg-light);
    border-radius: 6px;
    padding: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.legend-color {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-free .legend-color {
    background: var(--bp-free);
    border: 2px solid var(--bp-free-border);
}

.legend-leased .legend-color {
    background: var(--bp-leased);
    border: 2px solid var(--bp-leased-hover);
}

.legend-text {
    font-size: 13px;
    color: var(--bp-text-dark);
}

/* ==========================================================================
   Таблица свободных офисов
   ========================================================================== */

.free-offices-section {
    padding: 25px;
    border-top: 1px solid var(--bp-border);
}

.free-offices-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--bp-text-dark);
    margin: 0 0 20px;
}

.table-responsive {
    overflow-x: auto;
}

.free-offices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.free-offices-table thead {
    background: var(--bp-bg-light);
}

.free-offices-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--bp-text-dark);
    border-bottom: 2px solid var(--bp-border);
    white-space: nowrap;
}

.free-offices-table tbody tr {
    transition: var(--bp-transition);
    cursor: pointer;
}

.free-offices-table tbody tr:hover {
    background: var(--bp-free);
}

.free-offices-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--bp-border);
    vertical-align: middle;
}

.free-offices-table .office-number-cell {
    font-size: 16px;
}

.free-offices-table .yearly-cost {
    color: var(--bp-primary);
}

.free-offices-table .office-action-cell {
    text-align: right;
}

.btn-office-details {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bp-primary);
    color: var(--bp-white);
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--bp-transition);
}

.btn-office-details:hover {
    background: var(--bp-primary-hover);
}

/* ==========================================================================
   Popup с деталями офиса
   ========================================================================== */

.office-details-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--bp-transition);
}

.office-details-popup.visible {
    opacity: 1;
    visibility: visible;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.popup-content {
    position: relative;
    background: var(--bp-white);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--bp-shadow-hover);
    transform: scale(0.9);
    transition: var(--bp-transition);
}

.office-details-popup.visible .popup-content {
    transform: scale(1);
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bp-bg-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--bp-transition);
    padding: 0;
}

.popup-close:hover {
    background: var(--bp-border);
}

.popup-close .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--bp-text-dark);
}

.popup-header {
    padding: 25px 25px 15px;
    border-bottom: 1px solid var(--bp-border);
    display: flex;
    align-items: center;
    gap: 15px;
}

.popup-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--bp-text-dark);
}

.popup-title .office-number {
    color: var(--bp-primary);
}

.office-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.office-status-badge.status-free {
    background: var(--bp-free);
    color: var(--bp-free-border);
}

.office-status-badge.status-leased {
    background: #FFEBEE;
    color: #C62828;
}

.popup-body {
    padding: 20px 25px;
}

.office-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--bp-border);
}

.office-detail-row:last-child {
    border-bottom: none;
}

.office-detail-row.office-yearly-row {
    background: var(--bp-bg-light);
    margin: 15px -25px -20px;
    padding: 15px 25px;
    border-bottom: none;
}

.detail-label {
    font-size: 14px;
    color: var(--bp-text-light);
}

.detail-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--bp-text-dark);
}

.office-yearly-row .detail-value {
    font-size: 18px;
    color: var(--bp-primary);
}

.popup-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--bp-border);
    text-align: center;
}

.popup-contact-btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--bp-primary);
    color: var(--bp-white) !important;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none !important;
    transition: var(--bp-transition);
}

.popup-contact-btn:hover {
    background: var(--bp-primary-hover);
    color: var(--bp-white) !important;
}

/* Блокировка скролла при открытом popup */
body.popup-open {
    overflow: hidden;
}

/* ==========================================================================
   Сообщение об отсутствии этажей
   ========================================================================== */

.no-floors-message {
    text-align: center;
    padding: 60px 20px;
    background: var(--bp-white);
    border-radius: 8px;
    box-shadow: var(--bp-shadow);
}

.no-floors-message p {
    margin: 0;
    font-size: 16px;
    color: var(--bp-text-light);
}

/* ==========================================================================
   Адаптив для мобильных устройств
   ========================================================================== */

@media (max-width: 575px) {
    .building-plan-section {
        padding: 30px 0 40px;
    }
    
    .floor-tabs-header {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .floor-tab {
        padding: 12px 15px;
    }
    
    .floor-plan-header {
        padding: 12px 20px;
    }
    
    .floor-plan-title {
        font-size: 18px;
    }
    
    .floor-plan-body {
        padding: 15px;
        gap: 15px;
    }
    
    .floor-svg-container {
        padding: 10px;
    }
    
    .floor-stats,
    .floor-legend {
        padding: 12px;
    }
    
    .stat-item {
        padding: 6px 0;
    }
    
    .stat-label,
    .stat-value {
        font-size: 12px;
    }
    
    .free-offices-section {
        padding: 20px 15px;
    }
    
    .free-offices-title {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .free-offices-table th,
    .free-offices-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .btn-office-details {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .popup-content {
        width: 95%;
    }
    
    .popup-header {
        padding: 20px 20px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .popup-body {
        padding: 15px 20px;
    }
    
    .popup-footer {
        padding: 15px 20px;
    }
    
    .popup-contact-btn {
        width: 100%;
        padding: 14px 20px;
    }
}

/* ==========================================================================
   Утилиты
   ========================================================================== */

.mb-30 {
    margin-bottom: 30px;
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floor-content-block.active {
    animation: fadeIn 0.3s ease-out;
}
