/**
 * WP Residence Interactive Floorplan - Frontend Styles
 * Version: 1.0.0
 */

/* Main Container */
.wrif-floorplan-wrapper {
    max-width: 100%;
    margin: 20px 0;
    font-family: inherit;
}

.wrif-floorplan-container {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    min-height: 400px;
}

/* Responsive Grid */
@media (max-width: 768px) {
    .wrif-floorplan-container {
        grid-template-columns: 1fr;
    }
}

/* Slider Section */
.wrif-slider-section {
    position: relative;
    background: transparent;
    display: flex;
    flex-direction: column;
}

/* Media Tabs (Gallery/Video) */
.wrif-media-tabs {
    display: flex;
    background: transparent;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 20;
    gap: 10px;
}

.wrif-media-tab {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    background: #ffffff;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 700;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.wrif-media-tab:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

.wrif-media-tab.active {
    border-color: #dc3545;
    background: #ffffff;
    color: #dc3545;
    box-shadow: 0 2px 12px rgba(220, 53, 69, 0.2);
}

.wrif-media-tab .tab-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wrif-media-tab .tab-icon svg {
    width: 16px;
    height: 16px;
}

.wrif-media-tab .tab-text {
    font-weight: 700;
}

/* Floor Tabs */
.wrif-floor-tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

.wrif-floor-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.wrif-floor-tab:hover {
    background: #f8f9fa;
    color: #333;
}

.wrif-floor-tab.active {
    background: #007cba;
    color: white;
    border-bottom: 2px solid #005a87;
}

/* Floor Content */
.wrif-floor-content {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.wrif-floor-panel {
    display: none;
    width: 100%;
    height: 100%;
    padding: 15px;
    /* Ensure floorplan panels are always visible when active */
    visibility: visible !important;
    opacity: 1 !important;
}

.wrif-floor-panel.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    /* Force visibility */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Vision Pro Wrapper */
.wrif-vision-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Ensure content is visible */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Floorplan Section */
.wrif-floorplan-section {
    position: relative;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e9ecef;
    min-height: 400px;
    justify-content: space-between;
}

/* Placeholder when no floorplans */
.wrif-floorplan-section:not(:has(.wrif-floor-content)) {
    justify-content: center;
    align-items: center;
}

.wrif-floorplan-section:not(:has(.wrif-floor-content)) .wrif-floorplan-placeholder {
    min-height: 300px;
    max-height: 350px;
    margin: 20px;
    align-self: center;
    justify-self: center;
}

/* Media Tabs Bottom */
.wrif-media-tabs-bottom {
    display: flex;
    background: transparent;
    margin: 15px;
    margin-top: auto;
    flex-shrink: 0;
    gap: 10px;
    justify-content: center;
}

.wrif-media-tab-bottom {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    background: #ffffff;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 700;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 120px;
    justify-content: center;
}

.wrif-media-tab-bottom:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

.wrif-media-tab-bottom.active {
    border-color: #dc3545;
    background: #ffffff;
    color: #dc3545;
    box-shadow: 0 2px 12px rgba(220, 53, 69, 0.2);
}

.wrif-media-tab-bottom .tab-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wrif-media-tab-bottom .tab-icon svg {
    width: 16px;
    height: 16px;
}

.wrif-media-tab-bottom .tab-text {
    font-weight: 700;
}

/* Slider Container */
.wrif-slider-container {
    position: relative;
    flex: 1;
    overflow: hidden;
    min-height: 300px;
}

.wrif-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.wrif-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wrif-slide.active {
    opacity: 1;
}

.wrif-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video Content */
.wrif-video-container,
.wrif-wp-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
}

.wrif-video-container.active,
.wrif-wp-video-container.active {
    display: flex;
}

.wrif-video-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.wrif-wp-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Navigation */
.wrif-slider-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
    padding: 0 15px;
}

.wrif-nav-btn {
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: all;
}

.wrif-nav-btn:hover {
    background: rgba(0,0,0,0.8);
}

/* Thumbnail Section */
.wrif-thumbnail-section {
    background: #f8f9fa;
    height: 80px;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.wrif-thumbnails {
    display: flex;
    height: 100%;
    overflow-x: auto;
    gap: 2px;
    padding: 5px;
}

.wrif-thumbnail {
    min-width: 70px;
    height: 70px;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.wrif-thumbnail:hover {
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.05);
}

.wrif-thumbnail.active {
    border-color: #dc3545;
}

.wrif-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Slide Counter */
.wrif-slide-info {
    position: absolute;
    bottom: 90px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 15;
}

/* Placeholder */
.wrif-floorplan-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 15px;
    flex: 1;
    margin: 15px;
    text-align: center;
}

.wrif-placeholder-content {
    text-align: center;
    max-width: 250px;
}

.wrif-placeholder-icon {
    font-size: 36px;
    margin-bottom: 15px;
    opacity: 0.7;
}

.wrif-placeholder-content h3 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.wrif-placeholder-content p {
    margin: 0 0 8px 0;
    color: #6c757d;
    font-size: 13px;
    line-height: 1.4;
}

/* Error States */
.wrif-error {
    padding: 20px;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 4px;
    margin: 20px 0;
}

/* Debug Info */
.wrif-debug-info {
    font-size: 10px;
    color: #999;
    margin: 5px 15px;
    text-align: center;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 3px;
}

/* Vision Pro Element Highlighting */
.wrif-vision-wrapper .highlighted {
    outline: 3px solid #dc3545 !important;
    outline-offset: 2px !important;
    animation: wrif-highlight 3s ease-in-out;
}

@keyframes wrif-highlight {
    0%, 100% { outline-color: #dc3545; }
    50% { outline-color: #ff6b6b; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .wrif-floorplan-section {
        border-left: none;
        border-top: 1px solid #e9ecef;
        min-height: 350px;
    }
    
    .wrif-floor-content {
        min-height: 250px;
    }
    
    .wrif-floor-panel {
        padding: 10px;
    }
    
    .wrif-media-tabs {
        top: 10px;
        right: 10px;
    }
    
    .wrif-media-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .wrif-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .wrif-thumbnail {
        min-width: 60px;
        height: 60px;
    }
    
    .wrif-slide-info {
        bottom: 80px;
        right: 10px;
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Tab Icons */
.tab-icon {
    font-size: 14px;
    margin-right: 4px;
}

.tab-text {
    font-size: 13px;
}

/* Smooth Transitions */
.wrif-floorplan-wrapper * {
    transition: all 0.3s ease;
}

/* Focus States for Accessibility */
.wrif-floor-tab:focus,
.wrif-media-tab:focus,
.wrif-media-tab-bottom:focus,
.wrif-nav-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Loading States */
.wrif-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wrif-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: wrif-spin 1s linear infinite;
}

@keyframes wrif-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Critical visibility fixes */
.wrif-floor-panel,
.wrif-floor-panel.active,
.wrif-vision-wrapper {
    /* Prevent hiding */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    /* Ensure proper positioning */
    position: relative !important;
    z-index: 1 !important;
}

.wrif-floor-panel.active {
    display: flex !important;
}

/* Force floorplan content to be visible */
.wrif-floorplan-section .wrif-floor-content {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure floorplan section is always visible */
.wrif-floorplan-section {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
