/* Chivenor Site Map Styles */
.chivenor-sitemap {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

.sitemap-container {
    position: relative;
    width: 100%;
    height: auto;
}

.sitemap-image {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
}

.sitemap-image img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

.sitemap-image svg {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    max-width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
}

/* SVG Plot Areas - using the working image map pattern */
.sitemap-image svg .image-mapper-shape {
    cursor: pointer;
    transition: all 0.3s ease;
}

.sitemap-image svg .test-plot {
    fill: rgba(0, 0, 255, 0.3) !important;
    stroke: blue !important;
    stroke-width: 2 !important;
}

/* Plot Areas */
.plot-area {
    position: absolute !important;
    border: 2px solid #ffcc00;
    background-color: rgba(255, 255, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: auto;
    box-sizing: border-box;
}

.plot-area:hover {
    background-color: rgba(255, 255, 0, 0.3);
    border-color: #ffcc00;
    transform: scale(1.02);
}

.plot-area.plot-hover {
    border-color: var(--accent, #528579);
    background-color: rgba(82, 133, 121, 0.3);
}

/* Popup Modal */
.sitemap-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
}

.sitemap-popup.active {
    display: block;
}

/* Ensure both popup types are properly styled */
.home-popup,
.plot-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
}

.home-popup.active,
.plot-popup.active {
    display: block;
}

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

.popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: auto;
    z-index: 1001;
    border: 2px solid #333;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1002;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
}

.popup-close:hover {
    background-color: #f0f0f0;
    color: #333;
    border-color: #ccc;
}

.popup-body {
    padding: 40px 20px 20px;
    min-width: 300px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #528579;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Home Information Display */
.home-info {
    text-align: center;
}

.home-header {
    margin-bottom: 20px;
}

.home-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
}

.lodge-for-sale {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.plot-number {
    display: inline-block;
    background-color: #528579;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.home-image {
    margin: 20px 0;
}

.home-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.home-details {
    margin: 20px 0;
    text-align: left;
}

.home-details > div {
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid var(--accent, #528579);
}

.home-details strong {
    color: #374151;
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.home-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.home-actions {
    margin-top: 15px;
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    align-items: center;
}

.home-actions .button {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent, #528579);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.home-actions .button:hover {
    background: #4a7c6b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(82, 133, 121, 0.3);
}

.view-home-btn {
    display: inline-block;
    background-color: var(--accent);
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.view-home-btn:hover {
    background-color: #4a7c6b;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(82, 133, 121, 0.3);
}

.book-viewing-btn {
    display: inline-block;
    background-color: var(--global-color-8);
    color: var(--base-3);
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.book-viewing-btn:hover {
    background-color: #1a9a5a;
    color: var(--base-3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 154, 90, 0.3);
}

/* Plot Details Display */
.plot-header {
    margin-bottom: 20px;
    text-align: center;
}

.plot-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
}

.plot-details {
    text-align: left;
}

.plot-size {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid var(--accent, #528579);
}

.size-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.plot-description {
    margin: 15px 0;
    padding: 15px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #ccc;
}

.plot-description p {
    margin: 0;
    line-height: 1.6;
    color: #666;
}

.plot-actions {
    margin-top: 25px;
    text-align: center;
}

.plot-contact-btn {
    display: inline-block;
    background-color: var(--accent);
    color: var(--base-3);
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.plot-contact-btn:hover {
    background-color: var(--accent);
    color: var(--base-3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 20px;
    color: #d32f2f;
}

.error-message h3 {
    margin: 0 0 10px 0;
    color: #d32f2f;
}

.error-message p {
    margin: 10px 0;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .popup-content {
        max-width: 95%;
        width: 95%;
        margin: 20px;
        max-height: 90vh;
    }
    
    .popup-body {
        padding: 30px 15px 15px;
        min-width: 250px;
    }
    
    .home-header h3 {
        font-size: 20px;
    }
    
    .home-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .home-details > div {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .popup-content {
        width: 98%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .popup-body {
        padding: 25px 15px 15px;
        min-width: 200px;
    }
    
    .home-header h3 {
        font-size: 18px;
    }
    
    .plot-number {
        font-size: 12px;
        padding: 3px 10px;
    }
    
    .view-home-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Plot Area Hover Effects */
.plot-area::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, rgba(82, 133, 121, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.plot-area:hover::before {
    opacity: 1;
}

/* Focus States for Accessibility */
.plot-area:focus {
    outline: 3px solid var(--accent, #528579);
    outline-offset: 2px;
}

/* Hover Popup Styles */
.hover-popup {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    display: none;
}

.hover-popup-content {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Print Styles */
@media print {
    .sitemap-popup,
    .plot-area,
    .hover-popup {
        display: none !important;
    }
    
    .sitemap-image {
        max-width: 100%;
        height: auto;
    }
}
