/**
 * Frontend styles for Interactive Estate Map
 */

/* Main Container */
.iem-map-container {
    position: relative;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: visible; /* Allow tooltip to overflow */
    min-height: 400px; /* Ensure container has height for absolute positioning */
    z-index: 9999998; /* High z-index to ensure tooltip visibility */
}

.iem-map-wrapper {
    position: relative;
    width: 100%;
}

/* Image Container */
.iem-image-container {
    position: relative;
    width: 100%;
    line-height: 0;
}

.iem-estate-image {
    width: 100%;
    height: auto;
    display: block;
}

/* SVG Overlay */
.iem-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.iem-overlay polygon,
.iem-overlay text {
    pointer-events: all;
}

.iem-house-polygon {
    cursor: pointer;
    transition: all 0.3s ease;
}

.iem-house-polygon:hover {
    filter: brightness(1.2);
}

/* House Details Container */
.iem-house-details-container {
    position: relative;
    width: 100%;
    min-height: 400px;
    padding: 30px;
}

.iem-back-to-map {
    position: absolute;
    top: 20px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    z-index: 10;
}

.iem-back-to-map:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.iem-back-to-map .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.iem-house-content {
    max-width: 900px;
    margin: 0 auto;
    padding-top: 20px;
}

.iem-house-content h1,
.iem-house-content h2,
.iem-house-content h3 {
    color: #333;
    margin-top: 0;
}

.iem-house-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007cba;
}

.iem-house-content p {
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
}

.iem-house-content ul,
.iem-house-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.iem-house-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.iem-house-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 15px 0;
}

/* House Info Grid */
.iem-house-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.iem-info-item {
    padding: 15px;
    background: #f8f9fa;
    border-left: 3px solid #007cba;
    border-radius: 4px;
}

.iem-info-label {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.iem-info-value {
    font-size: 18px;
    color: #007cba;
}

/* Gallery */
.iem-house-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.iem-gallery-item {
    position: relative;
    padding-bottom: 75%;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
}

.iem-gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.iem-gallery-item:hover img {
    transform: scale(1.1);
}

/* Features List */
.iem-features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.iem-feature-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 15px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 20px;
    font-size: 14px;
}

.iem-feature-tag::before {
    content: '✓';
    margin-right: 5px;
    font-weight: bold;
}

/* Contact Form */
.iem-contact-form {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.iem-contact-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.iem-form-group {
    margin-bottom: 15px;
}

.iem-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.iem-form-group input,
.iem-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.iem-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.iem-submit-btn {
    padding: 12px 30px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.iem-submit-btn:hover {
    background: #005a87;
}

/* Loading State */
.iem-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
}

.iem-loading .spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: iem-spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes iem-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes iemFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.iem-fade-in {
    animation: iemFadeIn 0.5s ease forwards;
}

.iem-fade-out {
    animation: iemFadeOut 0.5s ease forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
    .iem-house-details-container {
        padding: 20px 15px;
    }
    
    .iem-back-to-map {
        position: static;
        width: 100%;
        margin-bottom: 20px;
        justify-content: center;
    }
    
    .iem-house-content {
        padding-top: 0;
    }
    
    .iem-house-info-grid {
        grid-template-columns: 1fr;
    }
    
    .iem-house-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .iem-features-list {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .iem-map-container {
        padding: 10px;
    }
    
    .iem-house-content h2 {
        font-size: 24px;
    }
    
    .iem-house-gallery {
        grid-template-columns: 1fr;
    }
    
    .iem-feature-tag {
        font-size: 12px;
        padding: 4px 12px;
    }
}

/* Apartment Details Table - Minimalist Style */
.iem-apartment-details {
    max-width: 600px;
    margin: 40px auto;
    padding: 40px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}


.iem-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    margin-bottom: 15px;
    color: #1a1a1a;
    border-radius: 0;
    background: none;
}

.iem-status-badge::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.iem-status-badge.status-dostepny::before,
.iem-status-badge.status-dostępny::before,
.iem-status-badge.status-Dostępny::before,
.iem-status-badge.status-Wolny::before,
.iem-status-badge.status-wolny::before {
    background: #4caf50;
}

.iem-status-badge.status-zarezerwowany::before,
.iem-status-badge.status-Zarezerwowany::before,
.iem-status-badge.status-Rezerwacja::before,
.iem-status-badge.status-rezerwacja::before {
    background: #f0a500;
}

.iem-status-badge.status-sprzedany::before,
.iem-status-badge.status-Sprzedany::before {
    background: #f44336;
}

.iem-status-badge.status-wynajete::before,
.iem-status-badge.status-wynajęte::before,
.iem-status-badge.status-niedostepny::before,
.iem-status-badge.status-niedostępny::before {
    background: #999999;
}

/* Compact 2-column Grid Layout */
.iem-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.iem-detail-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 13px;
    line-height: 1.4;
}

.iem-label {
    color: #666;
    font-size: 12px;
    min-width: fit-content;
}

.iem-value {
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 500;
}

/* Features Section */
.iem-features {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.iem-features-title {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.iem-features-list {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.iem-feature {
    font-size: 13px;
    color: #333;
}

.iem-actions {
    margin-top: 15px;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.iem-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #007cba;
    background: white;
    color: #007cba;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.iem-btn:hover {
    background: #007cba;
    color: white;
}

.iem-btn-reserve {
    background: #0E4745;
    color: white;
    border-color: #0E4745;
}

.iem-btn-reserve:hover {
    background: #0a3532;
    border-color: #0a3532;
}

.iem-icon {
    width: 16px;
    height: 16px;
}

/* Property Card Styles - Right Side */
.iem-modal-overlay {
    position: absolute;
    top: 50%;
    right: 70px;
    transform: translateY(-50%);
    bottom: auto;
    left: auto;
    width: auto;
    height: auto;
    background: transparent;
    z-index: 999999;
    display: block;
    animation: slideInRight 0.3s ease;
    padding: 0;
}

.iem-modal {
    position: relative;
    min-width: 320px;
    max-width: 380px;
    width: auto;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: none;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.iem-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: #333;
    padding: 0;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.iem-modal-close:hover {
    background: #f5f5f5;
    color: #000;
}

/* Property Card - New Design (Black & White) */
.iem-modal .iem-apartment-details {
    padding: 18px 20px;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    background: #ffffff;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: end;
}

.iem-modal .iem-property-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.iem-modal .iem-property-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.iem-modal .iem-property-status {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.iem-modal .iem-property-card-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
    white-space: nowrap;
    position: absolute;
    top: 16px;
    right: 48px;
    border-bottom: 1px solid transparent;
}

.iem-modal .iem-property-card-link:hover {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

.iem-modal .iem-property-card-link .iem-icon {
    width: 16px;
    height: 16px;
}

.iem-modal .iem-property-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.iem-modal .iem-property-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.iem-modal .iem-property-label {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.iem-modal .iem-property-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.iem-modal .iem-property-unit {
    font-size: 16px;
    font-weight: 400;
    color: #666;
    margin-left: 2px;
}

.iem-modal .iem-property-right {
    display: flex;
    align-items: flex-end;
}

.iem-modal .iem-btn-reserve-new {
    padding: 8px 16px;
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.iem-modal .iem-btn-reserve-new:hover {
    background: #ffffff;
    color: #1a1a1a;
}

.iem-modal .iem-btn-reserve-new .iem-icon {
    display: none;
}

/* Legacy styles for backwards compatibility */
.iem-modal .iem-apartment-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.iem-modal .iem-apartment-details h2 {
    font-size: 20px;
    margin: 0;
    color: #1a1a1a;
}

.iem-modal .iem-status-badge {
    padding: 4px 10px;
    font-size: 11px;
}

/* Compact Table in Modal */
.iem-modal .iem-details-table {
    margin-top: 15px;
}

.iem-modal .iem-details-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.iem-modal .iem-details-table td {
    padding: 10px 0;
}

.iem-modal .iem-details-table .iem-label {
    font-size: 12px;
    color: #888;
    width: 35%;
}

.iem-modal .iem-details-table .iem-value {
    font-size: 14px;
    color: #2c2c2c;
    font-weight: 500;
}

.iem-modal .iem-actions {
    margin-top: 20px;
    padding-top: 0;
    border-top: none;
}

/* Back to Main Map Button */
.iem-back-to-main-map {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: 2px solid #007cba;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.iem-back-to-main-map:hover {
    background: #007cba;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Hover Tooltip for Linked Maps */
.iem-hover-tooltip {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    min-width: 240px;
    max-width: 320px;
    z-index: 9999999;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Unavailable Tooltip - Simple Style */
.iem-unavailable-tooltip {
    min-width: auto;
    max-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.iem-unavailable-tooltip .iem-hover-tooltip-body {
    padding: 10px 16px;
}

.iem-unavailable-tooltip .iem-tooltip-text {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    text-align: center;
    line-height: 1.6;
}

.iem-unavailable-tooltip .iem-tooltip-text:first-child {
    margin-bottom: 4px;
}

.iem-hover-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.iem-hover-tooltip-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.iem-hover-tooltip-body {
    padding: 16px;
}

.iem-tooltip-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.iem-tooltip-row:last-child {
    border-bottom: none;
}

.iem-tooltip-row .label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.iem-tooltip-row .value {
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 600;
}

.iem-hover-tooltip-footer {
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e5e5e5;
    border-radius: 0 0 8px 8px;
    text-align: center;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* ============================
   Map Popup (simplified view)
   ============================ */
.iem-map-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.iem-map-popup {
    --iem-teal: #1c6b5e;
    position: absolute;
    transform: translate(-50%, -50%) scale(0.92);
    background: #ffffff;
    padding: 28px 30px 26px;
    border-radius: 18px;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.16);
    text-align: left;
    width: 264px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
    z-index: 10;
}

.iem-map-popup.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.iem-map-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #9aa3a0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.iem-map-popup-close:hover {
    color: #1a1a1a;
}

.iem-map-popup-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--iem-teal);
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 10px;
}

.iem-map-popup-info {
    min-height: 20px;
}

.iem-map-popup-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #2f2f2f;
}

.iem-map-popup-status::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9e9e9e;
    flex-shrink: 0;
}

.iem-map-popup-status.status-dostepny::before {
    background: #4caf50;
}

.iem-map-popup-status.status-zarezerwowany::before {
    background: #2196f3;
}

.iem-map-popup-status.status-sprzedany::before {
    background: #f44336;
}

.iem-map-popup-rows {
    margin-top: 22px;
}

.iem-map-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 11px 0;
}

.iem-map-popup-row-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9aa3a0;
}

.iem-map-popup-row-value {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
}

.iem-map-popup-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.iem-map-popup-btn,
.iem-map-popup-btn-reserve {
    display: block;
    width: 100%;
    padding: 15px 20px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.iem-map-popup-btn-reserve {
    background: var(--iem-teal);
    color: #ffffff;
    border: 1px solid var(--iem-teal);
}

.iem-map-popup-btn-reserve:hover {
    background: #155349;
    border-color: #155349;
}

.iem-map-popup-btn {
    background: #ffffff;
    color: var(--iem-teal);
    border: 1px solid var(--iem-teal);
    margin-top: 0;
    letter-spacing: normal;
}

.iem-map-popup-btn:hover {
    background: var(--iem-teal);
    color: #ffffff;
}

/* Legacy availability info (multi-post / linked maps) */
.iem-map-popup-count {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.iem-map-popup-label {
    font-size: 14px;
    font-weight: 400;
    color: #666;
    margin-bottom: 6px;
}

/* Mobile popup */
@media (max-width: 600px) {
    .iem-map-popup {
        padding: 18px 20px;
        width: 210px;
    }

    .iem-map-popup-title {
        font-size: 20px;
    }

    .iem-map-popup-count {
        font-size: 14px;
    }

    .iem-map-popup-btn,
    .iem-map-popup-btn-reserve {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .iem-back-to-map,
    .iem-modal-close,
    .iem-back-to-main-map,
    .iem-hover-tooltip {
        display: none;
    }
}

/* Modal Scrollbar */
.iem-modal::-webkit-scrollbar {
    width: 8px;
}

.iem-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.iem-modal::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.iem-modal::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Grouped Apartments Modal - same style as single popup */
.iem-grouped-modal {
    position: absolute;
    top: 50%;
    right: 70px;
    transform: translateY(-50%);
    bottom: auto;
    left: auto;
    width: auto;
    height: auto;
    background: transparent;
    z-index: 999999;
    display: block;
    animation: slideInRight 0.3s ease;
    padding: 0;
}

.iem-grouped-list-modal {
    position: relative;
    min-width: 400px;
    max-width: 480px;
    width: auto;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: none;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.iem-grouped-header {
    padding: 16px 20px 12px 20px;
    background: #ffffff;
    color: #1a1a1a;
    position: relative;
    border-bottom: none;
}

.iem-grouped-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #1a1a1a;
    line-height: 1.2;
}

.iem-grouped-count {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    font-weight: 500;
}

.iem-grouped-availability {
    margin: 6px 0 0 0;
    font-size: 13px;
    color: #4caf50;
    font-weight: 500;
}

.iem-grouped-availability strong {
    font-weight: 700;
}

.iem-grouped-list-modal .iem-modal-close {
    top: 12px;
    right: 12px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    color: #333;
    opacity: 1;
}

.iem-grouped-list-modal .iem-modal-close:hover {
    background: #f5f5f5;
    color: #000;
}

.iem-grouped-apartments-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 0;
}

.iem-grouped-apartment {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 20px;
    margin-bottom: 0;
    background: #ffffff;
    border-radius: 0;
    cursor: default;
    transition: all 0.2s ease;
    border: none;
    border-top: 1px solid #f0f0f0;
}

.iem-grouped-apartment:first-child {
    border-top: 1px solid #e8e8e8;
}

.iem-grouped-apartment:hover {
    background: #fafafa;
    transform: none;
}

.iem-grouped-apartment.unavailable {
    cursor: default;
    opacity: 0.5;
}

.iem-grouped-apartment.unavailable:hover {
    background: #ffffff;
}

/* Rented apartments - greyed out with red badge */
.iem-grouped-apartment.rented {
    cursor: default;
    opacity: 0.45;
    filter: grayscale(0.5);
}

.iem-grouped-apartment.rented:hover {
    background: #ffffff;
    opacity: 0.45;
}

.iem-grouped-apartment.rented .iem-status-badge {
    opacity: 1;
    filter: none;
}

.iem-apt-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.iem-apt-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.iem-apt-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

.iem-apt-info {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.iem-apt-area::after {
    content: '';
}

.iem-apt-rooms::before {
    content: '·';
    margin-right: 8px;
    color: #ccc;
}

.iem-apt-details-btn {
    padding: 8px 14px;
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.iem-apt-details-btn:hover {
    background: #ffffff;
    color: #1a1a1a;
}

/* Disabled details button for rented apartments */
.iem-apt-details-btn.disabled {
    background: #ccc;
    border-color: #ccc;
    color: #888;
    cursor: not-allowed;
    opacity: 0.6;
}

.iem-apt-details-btn.disabled:hover {
    background: #ccc;
    color: #888;
}

/* Status badges in grouped list */
.iem-grouped-apartment .iem-status-badge {
    margin: 0;
    padding: 0;
    font-size: 12px;
    border-radius: 0;
    flex-shrink: 0;
    background: none;
}

/* Mobile Property Card */
@media (max-width: 600px) {
    .iem-modal-overlay {
        top: auto;
        bottom: 10px;
        right: 10px;
        left: 10px;
        transform: none;
        width: auto;
    }

    .iem-modal {
        min-width: auto;
        max-width: none;
        width: 100%;
    }

    .iem-modal .iem-apartment-details {
        padding: 14px;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .iem-modal .iem-property-title {
        font-size: 18px;
    }

    .iem-modal .iem-property-value {
        font-size: 20px;
    }

    .iem-modal .iem-btn-reserve-new {
        width: 100%;
        justify-content: center;
        padding: 8px 14px;
        font-size: 11px;
    }

    .iem-modal-close {
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        font-size: 16px;
    }

    .iem-modal .iem-property-card-link {
        position: static;
        margin-top: 8px;
    }

    /* Grouped modal mobile */
    .iem-grouped-modal {
        top: auto;
        bottom: 10px;
        right: 10px;
        left: 10px;
        transform: none;
        width: auto;
    }

    .iem-grouped-list-modal {
        min-width: auto;
        max-width: none;
        width: 100%;
    }

    .iem-grouped-header {
        padding: 12px 16px 10px 16px;
    }

    .iem-grouped-header h3 {
        font-size: 18px;
    }

    .iem-grouped-count {
        font-size: 11px;
    }

    .iem-grouped-availability {
        font-size: 12px;
    }

    .iem-grouped-apartments-list {
        max-height: 250px;
    }

    .iem-grouped-apartment {
        padding: 10px 14px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .iem-apt-title {
        font-size: 13px;
    }

    .iem-apt-info {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 11px;
    }

    .iem-apt-rooms::before {
        display: none;
    }

    .iem-apt-details-btn {
        padding: 6px 12px;
        font-size: 10px;
    }
}
/* ===== Entrance marker (kropka + przerywana linia + napis "wejście") ===== */
.iem-entrance-marker {
    animation: iemEntranceFade 0.25s ease;
}

@keyframes iemEntranceFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== 360° viewer (rotatable model) ===== */
.iem-360-container {
    position: relative;
    /* Wspolny kontener map ma min-height: 400px (klasyczna mapa potrzebuje go pod
       elementy pozycjonowane absolutnie). Makieta 360 bierze wysokosc z canvasu,
       wiec na telefonie (render ok. 230 px) limit zostawial pod nia pusty pas. */
    min-height: 0;
    /* Limit wysokosci z shortcode'u (atrybut height, np. "80vh" albo "760px")
       przeliczony na maks. szerokosc: wysokosc x proporcja renderu.
       --iem-360-aspect ustawia JS po wczytaniu pierwszej klatki.
       Bez --iem-360-max-h calc() jest niepoprawny i max-width wraca do "none",
       czyli makieta zachowuje sie jak dotad. */
    max-width: calc(var(--iem-360-max-h) * var(--iem-360-aspect, 1.5));
    margin-left: auto;
    margin-right: auto;
}

.iem-360-viewport {
    position: relative;
    width: 100%;
    line-height: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.iem-360-viewport.iem-360-grabbing {
    cursor: grabbing;
}

.iem-360-viewport.iem-360-over-area:not(.iem-360-grabbing) {
    cursor: pointer;
}

.iem-360-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.iem-360-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.iem-360-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.4;
    z-index: 5;
}

.iem-360-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    z-index: 4;
    transition: opacity 0.6s ease;
}

.iem-360-progress.done {
    opacity: 0;
}

.iem-360-progress-bar {
    height: 100%;
    width: 0;
    background: #EFECE8; /* Porcelanowy Krem — czytelny na ciemnym renderze */
    transition: width 0.2s ease;
}

.iem-360-prev,
.iem-360-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(44, 52, 61, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: #EFECE8;
    font-size: 20px;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
    transition: background 0.2s ease, transform 0.2s ease;
}

.iem-360-prev:hover,
.iem-360-next:hover {
    background: rgba(58, 68, 79, 0.92);
    transform: translateY(-50%) scale(1.08);
}

.iem-360-prev {
    left: 14px;
}

.iem-360-next {
    right: 14px;
}

.iem-360-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    line-height: 1.4;
    z-index: 4;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.iem-360-hint .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
}

.iem-360-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

@media (max-width: 782px) {
    .iem-360-prev,
    .iem-360-next {
        width: 38px;
        height: 38px;
        line-height: 38px;
        font-size: 16px;
    }

    .iem-360-hint {
        font-size: 11px;
    }
}

.iem-360-fps-test-value {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #333;
}

/* ==========================================================================
   360° viewer — zoom controls, availability legend and detail panel
   Visual spec mirrors the "Makieta Osiedla" prototype 1:1.
   ========================================================================== */

/* Stage carries the zoom/pan transform; the UI above it stays unscaled */
.iem-360-stage {
    position: relative;
    width: 100%;
    transform-origin: 0 0;
    will-change: transform;
}

.iem-360-viewport.iem-360-zoomed .iem-360-stage {
    transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.iem-360-viewport.iem-360-grabbing .iem-360-stage {
    transition: none;
}

/* Vignette that lifts the overlaid UI off the render */
.iem-360-viewport::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(120% 90% at 50% 40%, rgba(0, 0, 0, 0) 40%, rgba(4, 7, 5, 0.55) 100%);
}

/* --- Zoom controls ------------------------------------------------------- */

.iem-360-zoom {
    position: absolute;
    top: 28px;
    right: 28px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.iem-360-zoom-buttons {
    display: flex;
    flex-direction: column;
    background: rgba(44, 52, 61, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
}

.iem-360-zoom-btn {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #EFECE8;
    font-family: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, opacity 0.18s ease;
}

.iem-360-zoom-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.iem-360-zoom-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.iem-360-zoom-in,
.iem-360-zoom-out {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.iem-360-zoom-fit {
    color: rgba(239, 236, 232, 0.75);
}

.iem-360-zoom-fit svg {
    display: block;
}

.iem-360-zoom-level {
    padding: 6px 12px;
    border-radius: 60px;
    background: rgba(44, 52, 61, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: rgba(239, 236, 232, 0.75);
    font-size: 12px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

/* Controls slide aside instead of hiding under the open panel */
.iem-360-viewport.iem-360-panel-open .iem-360-zoom {
    transform: translateX(-404px);
}

/* --- Availability legend -------------------------------------------------- */

.iem-360-legend {
    position: absolute;
    left: 28px;
    top: 28px;
    z-index: 6;
    max-width: calc(100% - 56px);
    padding: 0;
    border-radius: 20px;
    background: rgba(239, 236, 232, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(58, 68, 79, 0.14);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    color: #2C343D;
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.4;
    overflow: hidden;
}

/* nagłówek-przełącznik: ciemnozielona belka z kremowym napisem,
   rozwija/zwija resztę */
.iem-360-legend-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 12px 16px;
    background: #3A444F;
    border: none;
    color: #EFECE8;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s ease;
}

.iem-360-legend-toggle:hover {
    background: #48545F;
}

.iem-360-legend-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(239, 236, 232, 0.9);
}

.iem-360-legend-chevron {
    color: rgba(239, 236, 232, 0.7);
    transition: transform 0.25s ease;
}

.iem-360-legend.is-open .iem-360-legend-chevron {
    transform: rotate(180deg);
}

.iem-360-legend-body {
    display: none;
    padding: 4px 16px 16px;
}

/* logo osiedla w miejscu tekstowej nazwy (opcjonalne, z ustawień makiety) */
.iem-360-estate-logo {
    display: block;
    max-width: 210px;
    max-height: 72px;
    width: auto;
    height: auto;
    margin: 2px 0 12px;
}

.iem-360-legend.is-open .iem-360-legend-body {
    display: block;
}

/* --- Estate info in the expanded legend --- */

.iem-360-legend-estate {
    padding: 2px 0 14px;
    border-bottom: 1px solid rgba(58, 68, 79, 0.08);
    margin-bottom: 14px;
}

.iem-360-estate-name {
    margin: 0 0 12px;
    font-family: "Inria Serif", Georgia, "Times New Roman", serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 1.1;
    color: #2C343D;
}

.iem-360-estate-stats {
    display: flex;
    gap: 26px;
}

.iem-360-estate-stat b {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    color: #2C343D;
    font-variant-numeric: tabular-nums;
}

.iem-360-estate-stat b.is-free {
    color: #557F35;
}

.iem-360-estate-stat span {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(58, 68, 79, 0.4);
}

.iem-360-legend-caption {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(58, 68, 79, 0.45);
    margin-bottom: 10px;
}

.iem-360-legend-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.iem-360-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 9px 14px;
    border: 1px solid rgba(58, 68, 79, 0.14);
    border-radius: 60px;
    background: rgba(58, 68, 79, 0.04);
    color: rgba(58, 68, 79, 0.7);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.18s ease;
}

.iem-360-chip:hover {
    border-color: rgba(58, 68, 79, 0.4);
}

.iem-360-chip.is-active {
    background: #3A444F;
    border-color: #2C343D;
    color: #EFECE8;
}

.iem-360-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.iem-360-chip-count {
    color: rgba(58, 68, 79, 0.4);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.iem-360-legend-hint {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(58, 68, 79, 0.08);
    font-size: 12px;
    letter-spacing: 0.02em;
    color: rgba(58, 68, 79, 0.42);
}

/* --- Detail panel (slides in from the right, over the model) --------------- */

.iem-360-panel {
    /* Paleta strony. Morela idzie WYŁĄCZNIE na cenę, waniliowy na akcję główną —
       statusy mają własne kolory z Color Categories i tych dwóch nie używają. */
    --iem-wanilia: #D9E08F;
    --iem-wanilia-hover: #cbd479;
    --iem-morela: #C1682B;

    /* Panel siedzi WEWNĄTRZ makiety i jest przypięty do jej krawędzi: wysuwa się
       na niej, ma dokładnie jej wysokość i tam zostaje. Nie jest position: fixed,
       więc nie wędruje przy przewijaniu strony i nie potrafi wyjść poza obrys
       makiety. */
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 404px;
    max-width: 100%;
    height: auto;

    /* Niski z-index: sticky header ma przechodzić NAD panelem. Panel nie opuszcza
       kontekstu stosu kontenera makiety, więc nie ma jak się nad niego wybić. */
    z-index: 30;
    display: flex;
    flex-direction: column;
    /* Bez tego nagłówek i stopka (flex: none) wylewały się poza panel, gdy jego
       wysokość spadała do zera przy makiecie przewiniętej poza ekran. */
    overflow: hidden;
    background: rgba(247, 245, 241, 0.96);
    -webkit-backdrop-filter: blur(26px);
    backdrop-filter: blur(26px);
    border-left: 1px solid rgba(58, 68, 79, 0.14);
    box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
    color: #2C343D;
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
    pointer-events: none;
}

.iem-360-panel.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

/* Podniesiony selektor i wymuszone wartości, bo motyw ma własne style dla <button>
   i zjadał kolor znaku – krzyżyk robił się widoczny dopiero pod kursorem.
   Stan spoczynkowy jest też wyraźniejszy niż wcześniej (tło .07 -> .12). */
.iem-360-panel .iem-360-panel-close {
    position: absolute;
    top: 28px;
    right: 28px;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    flex: none;
    margin: 0 !important;
    padding: 0 !important;
    /* Kwadrat z lekko zaokrąglonymi rogami — te same wartości co krzyżyk w warstwie
       rzutu 3D (brzozowa-lokale): radius 8 px i to samo piaskowe tło. Kółko
       odstawało od reszty serwisu. */
    border-radius: 8px !important;
    background: #F2EDE3 !important;
    background-image: none !important;
    border: 1px solid rgba(58, 68, 79, 0.10) !important;
    box-shadow: none !important;
    color: #2C343D !important;
    font-family: inherit;
    font-size: 20px;
    font-weight: 400;
    line-height: 1 !important;
    text-transform: none;
    cursor: pointer;
    z-index: 4;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.iem-360-panel .iem-360-panel-close:hover,
.iem-360-panel .iem-360-panel-close:focus-visible {
    background: #E6DFD1 !important;
    border-color: rgba(58, 68, 79, 0.22) !important;
    color: #2C343D !important;
}

.iem-360-panel-scroll {
    flex: 1 1 auto;
    /* Bez min-height:0 element flex nie zwęża się poniżej wysokości swojej
       treści – stopka z przyciskami wypadała wtedy poza dolną krawędź ekranu. */
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Zapas na stopkę: jest poza flow, więc bez tego ostatni wiersz danych
       chowałby się pod przyciskami. */
    padding: 0 0 var(--iem-stopka-h, 0px);
}

/* Nieruchomy nagłówek nad obszarem przewijanym – tytuł nie ucieka do góry,
   gdy panel jest niższy niż jego treść. Zapas z prawej na krzyżyk. */
.iem-360-panel-head {
    flex: none;
    padding: 28px 78px 22px 28px;
    border-bottom: 1px solid rgba(58, 68, 79, 0.10);
}

.iem-360-panel-eyebrow {
    padding-right: 52px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(58, 68, 79, 0.45);
}

.iem-360-panel-title {
    margin: 6px 0 0;
    padding-right: 52px;
    /* Rodzinę bierzemy z nagłówków motywu (JS kopiuje ją z h3 do --iem-font-h3),
       żeby panel nie miał własnego kroju. Wpisana rodzina zostaje jako zapas,
       gdyby motyw nie dał się odczytać. */
    font-family: var(--iem-font-h3, "Inria Serif", Georgia, "Times New Roman", serif);
    font-size: 46px;
    font-weight: 400;
    line-height: 1;
    color: #2C343D;
}

.iem-360-panel-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 60px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.iem-360-panel-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.iem-360-panel-price {
    padding: 26px 28px;
    border-bottom: 1px solid rgba(58, 68, 79, 0.10);
}

.iem-360-panel-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(58, 68, 79, 0.45);
}

/* Morela z palety strony — wyłącznie na cenę. Nigdzie indziej w panelu
   ten kolor nie występuje, żeby kwota była jedynym akcentem. */
.iem-360-panel-price-value {
    margin-top: 8px;
    font-family: var(--iem-font-h3, "Inria Serif", Georgia, "Times New Roman", serif);
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--iem-morela, #C1682B);
    font-variant-numeric: tabular-nums;
}

.iem-360-panel-price-unit {
    margin-left: 10px;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0;
    color: rgba(58, 68, 79, 0.5);
}

.iem-360-panel-price-note {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(58, 68, 79, 0.5);
}

.iem-360-panel-rows {
    padding: 22px 28px;
}

.iem-360-panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid rgba(58, 68, 79, 0.07);
}

.iem-360-panel-row-label {
    font-size: 13.5px;
    color: rgba(58, 68, 79, 0.55);
}

.iem-360-panel-row-value {
    font-size: 14.5px;
    font-weight: 600;
    text-align: right;
    color: #2C343D;
    font-variant-numeric: tabular-nums;
}

/* Fixed footer under the scroll area — actions stay visible while
   the content above scrolls */
/* Stopka jest przypięta do dołu panelu, ale JS podnosi ją o tyle, o ile panel
   wystaje poniżej krawędzi ekranu — przyciski zostają widoczne, nie wychodząc
   poza panel. Wyjęta z flow (absolute), więc obszar przewijany dostaje pod nią
   zapas przez --iem-stopka-h. */
.iem-360-panel-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    /* Pełne krycie: stopka bywa podniesiona nad przycisk motywu i wtedy
       dziedziczone 96 % przepuszczało wiersze danych pod spodem. */
    background: #F7F5F1;
    border-top: 1px solid rgba(58, 68, 79, 0.10);
    transition: bottom 0.15s linear;
}

.iem-360-panel-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 16px 28px 24px;
}

/* Jak na kaflu listingu: "Karta lokalu" po lewej, akcja po prawej. */
.iem-360-panel-actions.has-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Selektory z ".iem-360-panel" celowo — motyw ma własne style dla <a> i <button>,
   które inaczej zjadały kolor tekstu i podkreślenie. */
.iem-360-panel .iem-360-panel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    margin: 0;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid rgba(58, 68, 79, 0.15);
    background: rgba(58, 68, 79, 0.06);
    background-image: none;
    box-shadow: none;
    color: #2C343D;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.iem-360-ico {
    width: 16px;
    height: 16px;
    flex: none;
}

.iem-360-ico-info {
    width: 15px;
    height: 15px;
}

.iem-360-panel-btn-zoom:hover {
    background: #3A444F;
    border-color: #2C343D;
    color: #EFECE8;
}

/* Waniliowy z palety strony na akcję główną. Ciemny tekst, bo tło jest jasne. */
.iem-360-panel .iem-360-panel-btn-primary {
    border-color: var(--iem-wanilia, #D9E08F);
    background: var(--iem-wanilia, #D9E08F);
    color: #2C343D;
    font-size: 14.5px;
    font-weight: 700;
}

.iem-360-panel .iem-360-panel-btn-primary:hover,
.iem-360-panel .iem-360-panel-btn-primary:focus-visible {
    background: #3A444F;
    border-color: #2C343D;
    color: #EFECE8;
}

.iem-360-panel .iem-360-panel-btn-ghost {
    background: transparent;
    color: rgba(58, 68, 79, 0.8);
}

.iem-360-panel .iem-360-panel-btn-ghost:hover,
.iem-360-panel .iem-360-panel-btn-ghost:focus-visible {
    background: #3A444F;
    border-color: #2C343D;
    color: #EFECE8;
}

/* --- Panel grupowy: kilka lokali w jednym obszarze (domy A1–A3) ---------- */

.iem-360-panel-lokale {
    padding: 8px 28px 22px;
}

.iem-360-panel-lokal {
    padding: 18px 0;
    border-bottom: 1px solid rgba(58, 68, 79, 0.10);
}

.iem-360-panel-lokal:last-child {
    border-bottom: 0;
}

.iem-360-panel-lokal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.iem-360-panel-lokal-nazwa {
    font-family: var(--iem-font-h3, "Inria Serif", Georgia, serif);
    font-size: 26px;
    line-height: 1.1;
    color: #2C343D;
}

.iem-360-panel-lokal-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.iem-360-panel-lokal-meta {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(58, 68, 79, 0.55);
}

.iem-360-panel-lokal-cena {
    margin-top: 8px;
    font-family: var(--iem-font-h3, "Inria Serif", Georgia, serif);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--iem-morela, #C1682B);
    font-variant-numeric: tabular-nums;
}

.iem-360-panel-lokal-cena small {
    display: block;
    margin-top: 3px;
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12.5px;
    font-weight: 400;
    color: rgba(58, 68, 79, 0.5);
}

.iem-360-panel-lokal-akcje {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.iem-360-panel-lokal-akcje .iem-360-panel-btn {
    padding: 10px 12px;
    font-size: 13px;
}

/* --- Rzut w panelu (to samo, co rewers kafla na listingu) ----------------- */

.iem-360-panel-rzut {
    padding: 22px 28px 0;
}

.iem-360-panel-rzut-kadr {
    position: relative;
    aspect-ratio: 1.4;
    border-radius: 10px;
    border: 1px solid rgba(58, 68, 79, 0.10);
    background: #fff;
    overflow: hidden;
}

.iem-360-panel-rzut-kadr img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin: 0;
}

.iem-360-panel-rzut-kadr img[hidden] {
    display: none !important;
}

/* Lupa kryje cały kadr, widać ją dopiero pod kursorem (jak na listingu).
   Na dotyku ikony nie ma, ale tapnięcie w rzut i tak otwiera powiększenie. */
.iem-360-panel .iem-360-lupa {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    background-image: none;
    box-shadow: none;
    cursor: zoom-in;
    z-index: 2;
}

.iem-360-lupa-kolo {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(44, 52, 61, 0.72);
    color: #fff;
    opacity: 0;
    transform: scale(0.88);
    transition: opacity 0.22s ease, transform 0.22s ease, background 0.22s ease;
}

.iem-360-lupa-kolo .iem-360-ico {
    width: 24px;
    height: 24px;
}

.iem-360-panel-rzut-kadr:hover .iem-360-lupa-kolo,
.iem-360-panel .iem-360-lupa:focus-visible .iem-360-lupa-kolo {
    opacity: 1;
    transform: scale(1);
}

.iem-360-rzut-tabs {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

.iem-360-panel .iem-360-rzut-tab {
    margin: 0;
    padding: 7px 14px;
    border: 1px solid rgba(58, 68, 79, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    background-image: none;
    box-shadow: none;
    color: #2C343D;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.iem-360-panel .iem-360-rzut-tab:hover,
.iem-360-panel .iem-360-rzut-tab.is-active {
    background: #3A444F;
    border-color: #2C343D;
    color: #EFECE8;
}

/* --- Dymek z historią ceny (jak przy cenie na listingu) ------------------- */

.iem-360-info {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    margin-left: 10px;
    color: rgba(58, 68, 79, 0.5);
    cursor: help;
}

.iem-360-info-dymek {
    position: absolute;
    bottom: calc(100% + 11px);
    left: 50%;
    z-index: 6;
    transform: translateX(-50%) translateY(4px);
    padding: 10px 14px;
    border-radius: 8px;
    background: #2C343D;
    color: #fff;
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.45;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.iem-360-info-dymek::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    border: 6px solid transparent;
    border-top-color: #2C343D;
    transform: translateX(-50%);
}

.iem-360-info-dymek b {
    display: block;
    font-weight: 600;
    color: #fff;
}

/* Pełna historia z rejestru (wtyczka Brzozowa – Ceny) */
.iem-360-info-tytul {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #fff;
}

.iem-360-info-wiersz {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 18px;
    color: rgba(255, 255, 255, 0.72);
}

.iem-360-info-wiersz b {
    display: inline;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

.iem-360-info-wiersz.is-biezaca,
.iem-360-info-wiersz.is-biezaca b {
    color: #fff;
    font-weight: 600;
}

.iem-360-info-min {
    display: block;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
}

.iem-360-info-min b {
    display: inline;
    color: #fff;
}

/* Dymek w wąskim panelu: przypięty do prawej, nie wychodzi poza panel */
.iem-360-info-dymek {
    left: auto;
    right: -8px;
    transform: translateY(4px);
    max-width: 320px;
}

.iem-360-info-dymek::after {
    left: auto;
    right: 12px;
    transform: none;
}

.iem-360-info:hover .iem-360-info-dymek,
.iem-360-info:focus .iem-360-info-dymek,
.iem-360-info:focus-visible .iem-360-info-dymek {
    transform: translateY(0);
}

.iem-360-info:hover .iem-360-info-dymek,
.iem-360-info:focus .iem-360-info-dymek,
.iem-360-info:focus-visible .iem-360-info-dymek {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* --- Lightbox rzutów --------------------------------------------------- */

.iem-360-lb {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    flex-direction: column;
    background: rgba(20, 24, 32, 0.94);
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.iem-360-lb.is-open {
    display: flex;
    opacity: 1;
}

.iem-360-lb-pasek {
    position: relative;
    z-index: 2;
    flex: none;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
}

.iem-360-lb-tytul {
    flex: 1 1 auto;
    min-width: 0;
    color: #fff;
    font-size: 20px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.iem-360-lb-tabs {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

/* Motyw ma własne style dla button — stąd wymuszone wartości */
.iem-360-lb .iem-360-lb-tab {
    margin: 0 !important;
    padding: 10px 18px !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    border-radius: 5px !important;
    background: rgba(255, 255, 255, 0.10) !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #fff !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.iem-360-lb .iem-360-lb-tab:hover,
.iem-360-lb .iem-360-lb-tab:focus-visible {
    background: rgba(255, 255, 255, 0.24) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.iem-360-lb .iem-360-lb-tab.is-active {
    background: #fff !important;
    border-color: #fff !important;
    color: #2C343D !important;
}

.iem-360-lb-zoom {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.10);
}

.iem-360-lb .iem-360-lb-zbtn {
    display: grid;
    place-items: center;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #fff !important;
    font-family: inherit !important;
    font-size: 19px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-transform: none !important;
    cursor: pointer;
    transition: background 0.18s ease;
}

.iem-360-lb .iem-360-lb-zbtn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.iem-360-lb-zoom-poziom {
    min-width: 52px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.iem-360-lb .iem-360-lb-zamknij {
    display: grid;
    place-items: center;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    border-radius: 5px !important;
    background: rgba(255, 255, 255, 0.14) !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #fff !important;
    font-family: inherit !important;
    font-size: 24px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-transform: none !important;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.iem-360-lb .iem-360-lb-zamknij:hover,
.iem-360-lb .iem-360-lb-zamknij:focus-visible {
    background: rgba(255, 255, 255, 0.26) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #fff !important;
}

.iem-360-lb-scena {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px 28px;
    overflow: hidden;
}

/* Powiększony rzut przewija się w obu osiach */
.iem-360-lb-scena.is-powiekszony {
    overflow: auto;
    align-items: safe center;
    justify-content: safe center;
    cursor: grab;
}

.iem-360-lb .iem-360-lb-scena img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 5px;
    background: #fff;
    transform-origin: center center;
    transition: transform 0.2s ease;
}

body.iem-360-blokada {
    overflow: hidden;
}

/* --- Telefon: pasek zaznaczenia zamiast szuflady ---------------------------
   Pasek stoi POD makietą w gnieździe .iem-360-mslot. Gniazdo ma na telefonie
   stałą wysokość zawsze (także bez zaznaczenia), więc pojawienie się paska
   nie przesuwa treści pod makietą. Na desktopie gniazda nie ma. */

.iem-360-mslot {
    display: none;
}

.iem-360-mpasek {
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 10px 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(58, 68, 79, 0.14);
    background: #F7F5F1;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
    color: #2C343D;
    font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.3;
}

.iem-360-mpasek-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: none;
}

.iem-360-mpasek-nazwa {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--iem-font-h3, "Inria Serif", Georgia, serif);
    font-size: 22px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.iem-360-mpasek .iem-360-mpasek-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: none;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid var(--iem-wanilia, #D9E08F);
    border-radius: 10px;
    background: var(--iem-wanilia, #D9E08F);
    background-image: none;
    box-shadow: none;
    color: #2C343D;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
}

.iem-360-mpasek .iem-360-mpasek-btn svg {
    width: 15px;
    height: 15px;
}

.iem-360-mpasek .iem-360-mpasek-zamknij {
    flex: none;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(58, 68, 79, 0.10) !important;
    border-radius: 8px !important;
    background: #F2EDE3 !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #2C343D !important;
    font-family: inherit;
    font-size: 20px;
    line-height: 1 !important;
    cursor: pointer;
}

@media (max-width: 767px) {
    /* Szuflady na telefonie nie ma — nawet gdyby JS chciał ją otworzyć. */
    .iem-360-panel {
        display: none !important;
    }

    /* Gniazdo: 12 px odstępu + pasek (ok. 62 px) — rezerwowane zawsze. */
    .iem-360-mslot {
        display: flex;
        align-items: flex-start;
        min-height: 76px;
        padding: 12px 0 0;
    }

    .iem-360-container.iem-360-mzaznaczenie .iem-360-mpasek {
        display: flex;
    }

    /* Telefon: bez podpowiedzi "Przeciągnij, aby obracać" i bez wskaźnika "100%".
       Kontrolki zoomu mniejsze i przesunięte pod prawą krawędź, żeby nie
       zasłaniały róży wiatrów w prawym dolnym rogu renderu. */
    .iem-360-hint,
    .iem-360-zoom-level {
        display: none;
    }

    .iem-360-zoom {
        top: 10px;
        right: 10px;
        gap: 0;
    }

    .iem-360-zoom-buttons {
        border-radius: 10px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }

    .iem-360-zoom-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .iem-360-zoom-fit svg {
        width: 13px;
        height: 13px;
    }
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
    .iem-360-zoom {
        top: 16px;
        right: 16px;
    }

    .iem-360-legend {
        left: 16px;
        top: 16px;
        max-width: calc(100% - 32px);
    }

    .iem-360-legend-toggle {
        padding: 10px 14px;
    }

    .iem-360-legend-body {
        padding: 2px 14px 12px;
    }

    .iem-360-legend-hint {
        display: none;
    }

    .iem-360-chip {
        padding: 7px 11px;
        font-size: 12px;
    }

    .iem-360-panel {
        width: 340px;
    }

    .iem-360-viewport.iem-360-panel-open .iem-360-zoom {
        transform: translateX(-340px);
    }

    .iem-360-panel-title {
        font-size: 38px;
    }

    .iem-360-panel-head,
    .iem-360-panel-price,
    .iem-360-panel-rows,
    .iem-360-panel-rzut,
    .iem-360-panel-lokale {
        padding-left: 20px;
        padding-right: 20px;
    }

    .iem-360-lb-pasek {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
    }

    .iem-360-lb-tytul {
        flex: 1 1 100%;
        order: -1;
        font-size: 17px;
    }

    .iem-360-lb .iem-360-lb-tab {
        padding: 9px 14px !important;
        font-size: 13px !important;
    }

    .iem-360-lb-scena {
        padding: 0 12px 16px;
    }

    .iem-360-panel-actions {
        padding-left: 20px;
        padding-right: 20px;
    }

    .iem-360-panel-close {
        top: 20px;
        right: 20px;
    }

    /* Wąski panel: dłuższa etykieta („Chcesz podobny?”) może się złamać,
       zamiast wypychać drugi przycisk poza obrys. */
    .iem-360-panel .iem-360-panel-btn {
        padding-left: 10px;
        padding-right: 10px;
        white-space: normal;
    }
}

@media (max-width: 600px) {
    .iem-360-panel {
        width: 100%;
        border-left: none;
    }

    .iem-360-viewport.iem-360-panel-open .iem-360-zoom,
    .iem-360-viewport.iem-360-panel-open .iem-360-legend {
        display: none;
    }
}
