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

:root {
    --site-header-height: 200px;
    --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;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    max-height: calc(100vh - var(--site-header-height) - 40px);
    overflow-y: auto;
    scrollbar-width: none;
    padding-bottom: 1px;
}

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

.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;
}

/* ===============  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;
    min-height: 300px;
}

.unit-modal-image {
    flex: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

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

/* ===============  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 {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unit-action-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--sightmap-secondary-color);
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.unit-action-link:hover {
    background: #f8f9fa;
    border-color: var(--sightmap-secondary-color);
    color: var(--sightmap-secondary-color);
    text-decoration: none;
}

.action-icon {
    margin-right: 8px;
    font-size: 16px;
}

.unit-apply-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: #28a745;
    color: #fff;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.unit-apply-button:hover {
    background: #218838;
    color: #fff;
    text-decoration: none;
}

.unit-apply-button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 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-content {
        width: 95%;
        max-width: 95%;
        max-height: calc(100vh - var(--site-header-height) - 30px);
    }
    
    .unit-modal-header {
        grid-template-columns: 1fr;
    }
    
    .unit-modal-header-right {
        text-align: left;
    }
    
    .unit-modal-body {
        flex-direction: column;
    }
    
    .unit-modal-image {
        min-height: 200px;
    }
    
    .unit-modal-header h2 {
        font-size: 26px;
    }
    
    .unit-modal-price {
        font-size: 22px;
    }
}

/* ===============  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;
}
