/* Body Map Styles - Dedizierte Styles für die interaktive Körperkarte */

/* Container und Layout */
.body-map-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f9fafb;
}

.body-map-wrapper {
    position: relative;
    flex: 1;
    min-height: 400px;
    max-height: 70vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e5e7eb 100%);
    border-radius: 0.75rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    overflow: auto;
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    /* Ensure content can scroll properly */
    padding: 10px;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .body-map-wrapper {
        min-height: 50vh;
        max-height: 60vh;
        padding: 5px;
    }
}

@media (max-width: 480px) {
    .body-map-wrapper {
        min-height: 45vh;
        max-height: 55vh;
        padding: 3px;
    }
}

.body-map-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.body-map-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.body-map-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.body-map-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.body-image {
    max-width: 100%;
    height: auto;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    display: block;
    margin: 0;
    position: relative;
    /* Ensure no centering or alignment issues */
    float: none;
    text-align: left;
}

/* Mobile image adjustments */
@media (max-width: 768px) {
    .body-image {
        /* Ensure image is not too large on mobile */
        width: 100%;
        max-width: 350px;
        height: auto;
    }
}

@media (max-width: 480px) {
    .body-image {
        max-width: 300px;
    }
}

/* Controls */
.body-map-controls {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.body-map-controls select,
.body-map-controls input {
    transition: all 0.2s ease;
}

.body-map-controls select:focus,
.body-map-controls input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.body-map-controls button {
    transition: all 0.2s ease;
}

.body-map-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* SVG Overlay */
.body-map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.body-map-overlay * {
    pointer-events: all;
}

/* Region Markers */
.body-region-marker {
    cursor: pointer;
    transition: all 0.2s ease;
}

.body-region-marker:hover {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.body-region-marker circle {
    transition: all 0.2s ease;
}

.body-region-marker:hover circle {
    stroke-width: 3px;
    opacity: 0.9;
}

/* Severity-based colors */
.severity-none { fill: #e5e7eb; stroke: #9ca3af; }
.severity-mild { fill: #10b981; stroke: #047857; }
.severity-moderate { fill: #f59e0b; stroke: #d97706; }
.severity-severe { fill: #ef4444; stroke: #dc2626; }
.severity-extreme { fill: #7c2d12; stroke: #451a03; }

/* Tooltips */
.body-region-tooltip {
    pointer-events: none;
    user-select: none;
}

.body-region-tooltip rect {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* Complaint Dialog */
.complaint-dialog-overlay {
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.complaint-dialog-content {
    animation: slideIn 0.3s ease-out;
    transform-origin: center;
}

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

/* Severity Slider */
.severity-slider {
    background: linear-gradient(
        to right,
        #10b981 0%,
        #f59e0b 50%,
        #ef4444 100%
    );
    height: 8px;
    border-radius: 4px;
    appearance: none;
    outline: none;
    cursor: pointer;
}

.severity-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.severity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.severity-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

/* Complaints Summary */
.complaints-summary {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
}

.complaint-item {
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.complaint-item:hover {
    background-color: #f8fafc;
    border-left-color: #3b82f6;
    transform: translateX(2px);
}

.complaint-item.severity-mild {
    border-left-color: #10b981;
}

.complaint-item.severity-moderate {
    border-left-color: #f59e0b;
}

.complaint-item.severity-severe {
    border-left-color: #ef4444;
}

.complaint-item.severity-extreme {
    border-left-color: #7c2d12;
}

/* Categories */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-button {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-button:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.category-button.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.category-button.active:hover {
    background: #2563eb;
}

/* Search */
.region-search {
    position: relative;
}

.region-search input {
    padding-left: 2.5rem;
}

.region-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
}

.search-result-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background: #f8fafc;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Loading States */
.body-map-loading {
    display: flex;
    items-center;
    justify-center;
    min-height: 400px;
    background: #f9fafb;
    border-radius: 0.75rem;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error States */
.body-map-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .body-map-controls {
        padding: 0.75rem;
    }
    
    .complaint-dialog-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    .category-filter {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }
    
    .category-button {
        flex-shrink: 0;
    }
}

@media (min-width: 1200px) {
    .body-map-wrapper {
        max-height: 75vh; /* Larger on big screens */
    }
}

@media (max-width: 480px) {
    .body-map-controls {
        padding: 0.5rem;
    }
    
    .severity-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .severity-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .body-region-marker circle {
        /* Larger touch targets on touch devices */
        r: 16px;
        min-radius: 16px;
    }
    
    .body-map-controls button {
        /* Larger touch targets for buttons */
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }
    
    .body-map-controls select,
    .body-map-controls input {
        /* Larger touch targets for form elements */
        min-height: 44px;
        padding: 12px;
    }
}

/* Zoom-specific styles */
.body-map-zoom-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    height: auto;
    min-height: 100%;
}

.body-map-image-container {
    position: relative;
    margin: 0;
    padding: 0;
    display: inline-block;
}

/* Mobile zoom container adjustments */
@media (max-width: 768px) {
    .body-map-zoom-container {
        align-items: center;
        padding: 10px;
    }
    
    .body-map-image-container {
        /* Ensure image fits better on mobile */
        max-width: 100%;
        display: block;
        margin: 0 auto;
    }
}

/* Print Styles */
@media print {
    .body-map-controls,
    .complaint-dialog-overlay {
        display: none;
    }
    
    .body-map-wrapper {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    .complaints-summary {
        page-break-inside: avoid;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .body-region-marker circle {
        stroke-width: 3px;
    }
    
    .severity-none { fill: #ffffff; stroke: #000000; }
    .severity-mild { fill: #00ff00; stroke: #000000; }
    .severity-moderate { fill: #ffff00; stroke: #000000; }
    .severity-severe { fill: #ff8000; stroke: #000000; }
    .severity-extreme { fill: #ff0000; stroke: #000000; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .body-region-marker,
    .complaint-dialog-content,
    .complaint-item,
    .category-button {
        transition: none;
    }
    
    .complaint-dialog-overlay {
        animation: none;
    }
    
    .complaint-dialog-content {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: #3b82f6;
    }
}

/* Focus Management */
.body-region-marker:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.category-button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Custom Scrollbars */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}