/**
 * Jorato Image Map Frontend Styles
 */

.jorato-property-map,
.jorato-area {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.jorato-wp-property-selector-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.jorato-view-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.jorato-view-btn {
    padding: 12px 20px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    height: 48px;
    box-sizing: border-box;
}

.jorato-view-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.jorato-view-btn.active {
    background: #495541;
    color: white;
    border-color: #3a4236;
}

.jorato-view-switch-btn {
    padding: 1.5px 7px;
    min-width: 48px;
    width: 48px;
    height: 48px;
}

.jorato-view-switch-btn svg {
    width: 34px;
    height: 45px;
}

.jorato-view-switch-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.jorato-view-switch-btn.active {
    background: #495541;
    color: white;
    border-color: #3a4236;
}

.jorato-view-switch-btn.active svg {
    color: white;
}

.jorato-view-switch-btn .jorato-switch-icon-placeholder {
    font-size: 24px;
    line-height: 1;
}

.jorato-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.jorato-map-image {
    max-width: 100%;
    height: auto;
    display: block;
}

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

.jorato-map-overlay polygon {
    pointer-events: all;
    transition: opacity 0.2s ease;
}

/* Hover effect - darken non-hovered shapes */
.jorato-map-overlay polygon.jorato-shape,
.jorato-map-overlay polygon.jorato-view-link {
    transition: opacity 0.2s ease;
}

/* When a shape is hovered, it stays at full opacity (handled by JS) */
.jorato-map-overlay polygon:hover {
    opacity: 1 !important;
}

.jorato-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 300px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transform-origin: center bottom;
}

.jorato-tooltip-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.jorato-tooltip-content p {
    margin: 4px 0;
    font-size: 13px;
}

/* View Link Tooltip Styles - Override default dark tooltip for view links */
.jorato-tooltip:has(.jorato-view-link-tooltip-content),
.jorato-tooltip.jorato-view-link-tooltip {
    background: rgba(255, 255, 255, 0.98) !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
    padding: 0 !important;
    max-width: 280px;
}

.jorato-view-link-tooltip-content {
    padding: 20px;
}

.jorato-view-link-tooltip-content h4 {
    margin: 0 0 14px 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    color: #333;
}

.jorato-view-link-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jorato-view-link-stats .jorato-stat-item {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

.jorato-view-link-stats .jorato-stat-label {
    font-weight: 700;
}

.jorato-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #666;
    font-style: italic;
}

/* Modal Styles */
.jorato-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.jorato-modal {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.jorato-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.jorato-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.jorato-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jorato-modal-close:hover {
    color: #333;
}

.jorato-modal-body {
    padding: 20px;
}

.jorato-modal-body p {
    margin: 8px 0;
    line-height: 1.5;
}

.jorato-modal-body .description {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .jorato-view-selector {
        justify-content: center;
    }
    
    .jorato-view-btn {
        padding: 10px 16px;
        font-size: 15px;
        min-height: 44px;
        height: 44px;
    }
    
    .jorato-view-switch-btn {
        min-width: 44px;
        width: 44px;
        height: 44px;
        padding: 1px 6px;
    }
    
    .jorato-view-switch-btn svg {
        width: 31px;
        height: 41px;
    }
    
    .jorato-tooltip {
        font-size: 13px;
        padding: 10px;
        max-width: 250px;
    }
    
    .jorato-modal {
        margin: 10px;
        max-height: 90vh;
    }
    
    .jorato-modal-header,
    .jorato-modal-body {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .jorato-view-btn {
        padding: 8px 14px;
        font-size: 14px;
        min-height: 40px;
        height: 40px;
    }
    
    .jorato-view-switch-btn {
        min-width: 40px;
        width: 40px;
        height: 40px;
        padding: 0;
    }
    
    .jorato-view-switch-btn svg {
        width: 28px;
        height: 37px;
    }
    
    .jorato-tooltip {
        font-size: 12px;
        padding: 8px;
        max-width: 200px;
    }
    
    .jorato-tooltip-content h4 {
        font-size: 14px;
    }
    
    .jorato-tooltip-content p {
        font-size: 12px;
    }
}

/* Theme Integration */
.jorato-property-map,
.jorato-area {
    font-family: inherit;
}

/* Accessibility */
.jorato-view-btn:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

.jorato-map-overlay polygon:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

/* View Link Labels */
.jorato-view-link-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* View Link Marker Container */
.jorato-view-link-marker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* View Link Marker Label */
.jorato-view-link-marker-label {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin-bottom: 8px;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* Expanded label with statistics */
.jorato-view-link-marker-label.jorato-view-link-label-expanded {
    white-space: normal;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 100px;
    max-width: 280px;
}

.jorato-view-link-marker-label.jorato-view-link-label-expanded .jorato-view-link-tooltip-content h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: #333;
}

.jorato-view-link-marker-label.jorato-view-link-label-expanded .jorato-view-link-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jorato-view-link-marker-label.jorato-view-link-label-expanded .jorato-view-link-stats .jorato-stat-item {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

.jorato-view-link-marker-label.jorato-view-link-label-expanded .jorato-view-link-stats .jorato-stat-label {
    font-weight: 700;
}

/* View Link Marker Icon */
.jorato-view-link-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    animation: jorato-marker-pulse 2s ease-in-out infinite;
}

.jorato-view-link-marker-icon svg {
    width: 100%;
    height: 100%;
}

.jorato-marker-placeholder {
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #666;
    border-radius: 50%;
    display: inline-block;
}

/* Pulsing animation for marker */
@keyframes jorato-marker-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.9;
    }
}

/* Property Drawer Styles */
.jorato-property-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.jorato-property-drawer-overlay.jorato-drawer-overlay-visible {
    opacity: 1;
    pointer-events: all;
}

.jorato-property-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    height: 100vh;
    background: white;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
}

.jorato-property-drawer.jorato-drawer-open {
    transform: translateX(0);
}

/* Drawer Header */
.jorato-drawer-header {
    background: #495541;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}

.jorato-drawer-header-content {
    flex: 1;
}

.jorato-drawer-status {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.jorato-drawer-status .jorato-status-date {
    font-weight: 400;
    opacity: 0.85;
}

.jorato-drawer-address {
    font-size: 13px;
    opacity: 0.95;
}

.jorato-drawer-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 16px;
    transition: opacity 0.2s ease;
}

.jorato-drawer-close:hover {
    opacity: 0.8;
}

/* Drawer Body */
.jorato-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.jorato-drawer-property-id {
    font-size: 12px;
    color: #666;
    margin-bottom: 16px;
}

/* Main Image */
.jorato-drawer-main-image-container {
    width: 100%;
    margin-bottom: 12px;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.jorato-drawer-main-image {
    width: 100%;
    height: auto;
    display: block;
}

.jorato-drawer-main-image-container .jorato-carousel-prev,
.jorato-drawer-main-image-container .jorato-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: #333;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.jorato-drawer-main-image-container .jorato-carousel-prev {
    left: 12px;
}

.jorato-drawer-main-image-container .jorato-carousel-next {
    right: 12px;
}

.jorato-drawer-main-image-container .jorato-carousel-prev:hover,
.jorato-drawer-main-image-container .jorato-carousel-next:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Image Carousel */
.jorato-drawer-image-carousel {
    margin-bottom: 20px;
    position: relative;
}

.jorato-carousel-thumbnails {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
}

.jorato-carousel-thumbnails:active {
    cursor: grabbing;
}

.jorato-carousel-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.jorato-carousel-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.jorato-carousel-thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.jorato-carousel-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.jorato-carousel-thumbnail {
    width: 60px;
    height: 60px;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
    pointer-events: auto;
}

.jorato-drawer-carousel-address {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-top: 20px;
    line-height: 1.4;
}

.jorato-drawer-carousel-address-city {
    font-weight: 400;
}

.jorato-drawer-available-from {
    font-size: 16px;
    color: #666;
    margin-top: 12px;
    line-height: 1.4;
}

.jorato-carousel-thumbnail:hover {
    border-color: #495541;
}

.jorato-carousel-thumbnail.active {
    border-color: #495541;
}

/* Action Buttons */
.jorato-drawer-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.jorato-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    color: #333;
}

.jorato-action-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.jorato-action-btn svg {
    stroke: currentColor;
}

/* Statistics */
.jorato-drawer-stats {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 0;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.jorato-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.jorato-stat-item.jorato-stat-box {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 0;
    margin-bottom: 0;
    gap: 6px;
    flex: 1;
    min-width: 120px;
}

.jorato-stat-item.jorato-stat-box .jorato-stat-icon {
    display: none;
}

.jorato-stat-item.jorato-stat-box .jorato-stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 0;
    font-weight: 400;
}

.jorato-stat-item.jorato-stat-box .jorato-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-left: 0;
}

.jorato-stat-icon {
    flex-shrink: 0;
    color: #666;
}

.jorato-stat-label {
    font-weight: 500;
    color: #333;
}

.jorato-stat-value {
    color: #333;
    margin-left: auto;
}

/* Price */
.jorato-drawer-price {
    margin-bottom: 0;
    padding-bottom: 0;
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.jorato-price-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.jorato-price-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

/* Contact Section */
.jorato-drawer-contact {
    padding: 20px 0 0 0;
    margin-bottom: 20px;
}

.jorato-contact-heading {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px 0;
}

.jorato-contact-person {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.jorato-contact-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.jorato-contact-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jorato-contact-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.jorato-contact-title {
    font-size: 14px;
    color: #666;
    line-height: 1.3;
}

.jorato-contact-email,
.jorato-contact-phone {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.jorato-contact-email a,
.jorato-contact-phone a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.jorato-contact-email a:hover,
.jorato-contact-phone a:hover {
    color: #495541;
    text-decoration: underline;
}

/* Drawer Footer */
.jorato-drawer-footer {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    margin-top: auto;
}

.jorato-cta-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
}

.jorato-cta-btn.jorato-cta-link {
    border: none;
}

.jorato-cta-primary {
    background: #495541;
    color: white;
}

.jorato-cta-primary:hover {
    background: #3a4236;
}

/* Responsive Drawer */
@media (max-width: 768px) {
    .jorato-property-drawer {
        width: 100%;
        max-width: 450px;
    }
}

@media (max-width: 480px) {
    .jorato-property-drawer {
        width: 100%;
    }
    
    .jorato-drawer-body {
        padding: 16px;
    }
    
    .jorato-drawer-header {
        padding: 12px 16px;
    }
}

/* Print Styles */
@media print {
    .jorato-tooltip,
    .jorato-modal-overlay,
    .jorato-view-link-labels {
        display: none !important;
    }
    
    .jorato-map-overlay polygon {
        stroke-width: 1px !important;
    }
}
