/**
 * SightMap Integration Styles
 * Styles for interactive floor plan maps
 */

:root {
    --site-header-height: 200px;
    --primary-color: #dc3545;
    --sightmap-secondary-color: #007cba;
}

/* ===============  MAP CONTAINER  =============== */
.sightmap-wrapper {
    position: relative;
    width: 100%;
    height: 600px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.sightmap-wrapper iframe {
    display: block;
    border: 0;
    width: 100%;
    height: 100%;
}

/* ===============  VIEW TOGGLE  =============== */
.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.view-toggle-btn {
    flex: 1;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.view-toggle-btn:hover {
    border-color: var(--sightmap-secondary-color);
    color: var(--sightmap-secondary-color);
}

.view-toggle-btn.active {
    background: var(--sightmap-secondary-color);
    border-color: var(--sightmap-secondary-color);
    color: white;
}

.view-toggle-icon {
    font-size: 20px;
}

/* ===============  VIEW CONTAINERS  =============== */
.grid-view {
    display: block;
}

.map-view {
    display: none;
}

.map-view.active {
    display: block;
}

.grid-view.hidden {
    display: none;
}

/* ===============  MODAL OVERLAY  =============== */
html.modal-open,
body.modal-open {
    overflow: hidden;
}

.unit-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    padding-top: calc(var(--site-header-height) + 20px);
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.unit-modal::-webkit-scrollbar {
    display: none;
}

/* ===============  MODAL CONTENT  =============== */
.unit-modal-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: calc(100vh - var(--site-header-height) - 40px);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.unit-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    z-index: 10;
}

.unit-modal-close:hover {
    color: #000;
    background: #fff;
}

/* ===============  AVAILABILITY BADGE MODAL  =============== */
.availability-badge-modal {
    position: absolute;
    top: 15px;
    right: 50px;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
}

.availability-badge-modal.available {
    background: #e7f7ec;
    color: #0a7a33;
}

.availability-badge-modal.coming {
    background: transparent;
    border: 1px solid #0a7a33;
    color: #0a7a33;
}

/* ===============  MODAL HEADER  =============== */
.unit-modal-header {
    padding: 20px 40px 15px 20px;
    border-bottom: 1px solid #eee;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.unit-modal-header-right {
    text-align: right;
}

.unit-modal-header-right > * {
    margin-bottom: 5px;
}

.unit-modal-header-right > *:last-child {
    margin-bottom: 0;
}

.unit-modal-header h2 {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.unit-modal-details {
    font-size: 16px;
    color: #666;
    font-weight: 500;
    line-height: 1.3;
}

.unit-modal-floorplan {
    font-size: 14px;
    color: #888;
    line-height: 1.3;
}

.unit-modal-availability {
    font-size: 14px;
    color: #28a745;
    font-weight: 500;
    line-height: 1.3;
}

.unit-modal-price {
    font-size: 26px;
    font-weight: 700;
    color: var(--sightmap-secondary-color);
    line-height: 1.2;
}

/* ===============  MODAL BODY  =============== */
.unit-modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

@media (min-width: 769px) {
    .unit-modal-body {
        overflow: hidden;
    }
}

.unit-modal-image {
    flex: 1 1 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
}

.unit-modal-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ===============  FEES BREAKDOWN  =============== */
.unit-modal-fees {
    flex: 1 1 45%;
    padding: 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

@media (min-width: 769px) {
    .unit-modal-fees {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.unit-modal-fees h3 {
    margin: 0 0 15px 0;
    font-family: "plantin", sans-serif !important;
    font-weight: 400 !important;
    font-size: 24px !important;
    color: #333;
}

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

.fees-breakdown-table th {
    text-align: left;
    font-weight: 500;
    color: #666;
    padding: 8px 0;
}

.fees-breakdown-table td {
    text-align: right;
    padding: 8px 0;
    color: #333;
    font-weight: 500;
}

.fees-breakdown-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.fees-breakdown-table tbody tr:last-child {
    border-bottom: none;
}

.fees-breakdown-table tfoot {
    border-top: 2px solid #ddd;
}

.fees-breakdown-table .fees-total-row th,
.fees-breakdown-table .fees-total-row td {
    font-weight: 700;
    font-size: 16px;
    color: var(--sightmap-secondary-color);
    padding: 12px 0 0 0;
}

.unit-modal-fees .fees-note {
    font-size: 11px;
    color: #999;
    margin: 10px 0 0 0;
    text-align: center;
}

/* ===============  LOADING STATE  =============== */
.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #666;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===============  MODAL ACTIONS  =============== */
.unit-modal-actions {
    padding: 15px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

.unit-modal-actions .fpo-btn-cta-primary {
    width: auto;
    margin: 0;
}



.unit-apply-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white !important;
    border: 1px solid var(--primary-color);
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.unit-apply-button:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
    text-decoration: none;
    filter: brightness(0.85);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.unit-apply-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.unit-apply-button .dashicons {
    font-size: 18px;
}

.unit-modal-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    text-align: center;
    color: #666;
}

.unit-modal-footer small {
    font-size: 12px;
    line-height: 1.4;
}

/* ===============  RESPONSIVE  =============== */
@media (max-width: 768px) {
    :root {
        --site-header-height: 80px;
    }
    
    .view-toggle {
        flex-direction: column;
        gap: 10px;
    }
    
    .view-toggle-btn {
        width: 100%;
    }
    
    .sightmap-wrapper {
        height: 500px;
    }
    
    .unit-modal {
        padding-top: 0;
        background: #fff;
    }
    
    .unit-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        box-shadow: none;
    }
    
    .unit-modal-header {
        display: block;
        padding: 12px 40px 12px 15px;
        flex-shrink: 0;
        border-bottom: 1px solid #e9ecef;
    }
    
    .unit-modal-header h2 {
        font-size: 20px;
        font-weight: 700;
        margin: 0 0 6px 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .unit-modal-floorplan {
        font-size: 13px;
        color: #666;
        margin: 0;
    }
    
    .unit-modal-details {
        font-size: 13px;
        color: #666;
        margin: 0;
    }
    
    .unit-modal-availability {
        font-size: 13px;
        display: inline-block;
        color: #28a745;
        font-weight: 600;
    }
    
    .unit-modal-price {
        display: none;
    }
    
    .unit-modal-header-right {
        display: none;
    }
    
    .unit-modal-header-left {
        width: 100%;
    }
    
    .unit-modal-body {
        display: block;
        overflow: visible;
    }
    
    .unit-modal-image {
        padding: 15px;
        min-height: auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .unit-modal-image img {
        max-height: 250px;
        width: auto;
        max-width: 100%;
        height: auto;
    }
    
    .unit-modal-fees {
        width: 100%;
        border-top: 1px solid #e9ecef;
        padding: 15px;
        overflow: visible;
    }
    
    .unit-modal-fees h3 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .fees-breakdown-table {
        font-size: 13px;
    }
    
    .fees-breakdown-table th,
    .fees-breakdown-table td {
        padding: 6px 0;
    }
    
    .fees-breakdown-table .fees-total-row th,
    .fees-breakdown-table .fees-total-row td {
        font-size: 14px;
    }
    
    .unit-apply-button {
        font-size: 15px;
        padding: 12px 20px;
    }
    
    .unit-modal-actions {
        padding: 15px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .unit-modal-actions .fpo-btn-cta-primary {
        width: 100%;
    }
    
    .unit-modal-close {
        width: 28px;
        height: 28px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }

    .availability-badge-modal {
        top: 10px;
        right: 45px;
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* ===============  LOADING SKELETON  =============== */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 16px;
}

.map-loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #ddd;
    border-top: 4px solid var(--sightmap-secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}
