/**
 * Body Map CSS - Styling for interactive body maps
 */

/* Container */
.body-map-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Left/Right Orientation Labels */
.body-map-labels {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
    padding: 0 1rem;
}

.left-label {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.right-label {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.body-map-labels .badge {
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0.9;
}

/* SVG Maps */
.body-map {
    width: 100%;
    max-height: 600px;
    margin: 0 auto;
    display: block;
}

/* Fix for SVG display */
svg.body-map {
    background-color: white;
}

svg.body-map .body-outline {
    fill: none !important;
    stroke: #333 !important;
    stroke-width: 1 !important;
}

/* View Navigation */
.body-map-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.body-map-nav button {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 48px; /* Touch target minimum */
    min-width: 120px;
}

.body-map-nav button.active {
    background-color: #007bff;
    color: white;
}

.body-map-nav button:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Body Parts */
.body-part {
    fill: #e9ecef !important;
    stroke: #adb5bd !important;
    stroke-width: 1 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    transform-origin: center !important;
}

.body-part:hover {
    fill: #cfe2ff !important;
    stroke-width: 2 !important;
}

.body-part.selected {
    fill: #0d6efd !important;
    stroke: #0a58ca !important;
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 3px rgba(13, 110, 253, 0.5)) !important;
}

.body-part:focus {
    outline: none !important;
    fill: #cfe2ff !important;
    stroke-width: 2 !important;
}

.body-part.selected:hover,
.body-part.selected:focus {
    fill: #0a58ca !important;
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 5px rgba(10, 88, 202, 0.7)) !important;
}

/* Debug mode styling */
.body-map-debug .body-part.selected {
    fill: #dc3545 !important;
    stroke: #b02a37 !important;
    animation: pulse-selection 1s infinite !important;
}

@keyframes pulse-selection {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Labels */
.body-part-label {
    font-size: 12px;
    pointer-events: none;
    user-select: none;
}

/* Selected Parts List */
.selected-parts {
    min-height: 60px;
}

.selected-parts-list {
    margin-top: 1.5rem;
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
    min-height: 40px;
}

.selected-parts-badge {
    display: inline-block;
    background-color: #e9ecef;
    color: #212529;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.2;
}

.selected-parts-badge .remove-part {
    margin-left: 0.5rem;
    cursor: pointer;
    font-weight: bold;
    padding: 0.25rem;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.1);
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Counter */
.selection-counter {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
    text-align: center;
}

/* Loading States */
.body-map-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Progress Steps - Mobile responsive */
.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    padding: 0 10px;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10px;
    right: 10px;
    height: 2px;
    background-color: #e9ecef;
    z-index: 1;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    cursor: pointer;
    transition: all 0.3s ease;
}

.progress-step.clickable:hover {
    transform: translateY(-2px);
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.progress-step.completed .step-circle {
    background-color: #28a745;
    color: white;
}

.progress-step.active .step-circle {
    background-color: #007bff;
    color: white;
}

.step-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
}

@media (min-width: 576px) {
    .step-label {
        font-size: 0.85rem;
    }
}

/* Pain Scale Styling */
.pain-scale-container {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.pain-scale-labels {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.pain-scale {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pain-scale-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.pain-scale-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.pain-scale-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    background-color: white;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.pain-scale-option.no-pain label {
    border-color: #28a745;
    color: #28a745;
}

.pain-scale-option.mild label {
    border-color: #17a2b8;
    color: #17a2b8;
}

.pain-scale-option.moderate label {
    border-color: #ffc107;
    color: #856404;
}

.pain-scale-option.severe label {
    border-color: #dc3545;
    color: #dc3545;
}

.pain-scale-option input[type="radio"]:checked + label {
    color: white;
    transform: scale(1.1);
}

.pain-scale-option.no-pain input[type="radio"]:checked + label {
    background-color: #28a745;
    border-color: #28a745;
}

.pain-scale-option.mild input[type="radio"]:checked + label {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.pain-scale-option.moderate input[type="radio"]:checked + label {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.pain-scale-option.severe input[type="radio"]:checked + label {
    background-color: #dc3545;
    border-color: #dc3545;
}

.pain-scale-option input[type="radio"]:focus + label {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.pain-scale-description {
    text-align: center;
    font-weight: 500;
    color: #495057;
    min-height: 1.5rem;
}

/* Pain Pattern Options */
.pain-pattern-option {
    height: 100%;
}

.pain-pattern-option .form-check-input {
    position: absolute;
    opacity: 0;
}

.pain-pattern-option .form-check-label {
    display: block;
    padding: 1.5rem;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    height: 100%;
    background-color: white;
}

.pain-pattern-option .form-check-label:hover {
    border-color: #0d6efd;
    background-color: #f8f9fa;
}

.pain-pattern-option .form-check-input:checked + .form-check-label {
    border-color: #0d6efd;
    background-color: #e7f1ff;
    color: #0d6efd;
}

.pain-pattern-option .form-check-input:focus + .form-check-label {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.pattern-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #6c757d;
}

.pain-pattern-option .form-check-input:checked + .form-check-label .pattern-icon {
    color: #0d6efd;
}

/* Pain Characteristics */
.pain-characteristics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.characteristic-option {
    position: relative;
}

.characteristic-option .form-check-input {
    position: absolute;
    opacity: 0;
}

.characteristic-option .form-check-label {
    display: block;
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background-color: white;
    font-weight: 500;
}

.characteristic-option .form-check-label:hover {
    border-color: #0d6efd;
    background-color: #f8f9fa;
}

.characteristic-option .form-check-input:checked + .form-check-label {
    border-color: #0d6efd;
    background-color: #e7f1ff;
    color: #0d6efd;
}

.characteristic-option .form-check-input:focus + .form-check-label {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .body-map-container {
        padding: 0.75rem;
    }
    
    /* Adjust label positioning for mobile */
    .body-map-labels {
        padding: 0 0.5rem;
    }
    
    .body-map-labels .badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
    
    .body-map-nav {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .body-map-nav button {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .body-map {
        max-height: 400px;
    }
    
    .selected-parts-badge {
        padding: 0.75rem 1rem;
        margin: 0.5rem 0.25rem;
        font-size: 1rem;
        display: block;
        text-align: center;
    }
    
    .selected-parts-badge .remove-part {
        min-width: 32px;
        min-height: 32px;
        font-size: 1.2rem;
    }
    
    .progress-steps {
        gap: 0.25rem;
        margin-bottom: 1.5rem;
    }
    
    .progress-step {
        min-width: 60px;
        padding: 0 0.25rem;
    }
    
    .progress-step:not(:last-child)::after {
        display: none;
    }
    
    .step-circle {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }
    
    .step-label {
        font-size: 0.7rem;
    }
    
    /* Pain Scale Mobile */
    .pain-scale {
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: center;
    }
    
    .pain-scale-option {
        flex: 0 0 auto;
    }
    
    .pain-scale-option label {
        width: 56px;
        height: 56px;
        font-size: 1.2rem;
    }
    
    .pain-scale-labels {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    /* Pain Pattern Mobile */
    .pain-pattern-option .form-check-label {
        padding: 1rem 0.75rem;
    }
    
    .pattern-icon {
        font-size: 1.5rem;
    }
    
    /* Pain Characteristics Mobile */
    .pain-characteristics-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .characteristic-option .form-check-label {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .body-map-container {
        padding: 0.5rem;
    }
    
    /* Further adjust labels for very small screens */
    .body-map-labels {
        padding: 0 0.25rem;
    }
    
    .body-map-labels .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.375rem;
    }
    
    .body-map {
        max-height: 350px;
    }
    
    .selected-parts-list {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
    
    .progress-steps {
        justify-content: space-around;
    }
    
    .progress-step {
        min-width: 50px;
    }
    
    .step-label {
        font-size: 0.65rem;
        line-height: 1.2;
    }
    
    /* Pain Scale Extra Small */
    .pain-scale-container {
        padding: 1rem;
    }
    
    .pain-scale {
        gap: 0.5rem;
    }
    
    .pain-scale-option label {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }
    
    .pain-scale-labels {
        font-size: 0.8rem;
    }
    
    /* Pain Pattern Extra Small */
    .pain-pattern-option .form-check-label {
        padding: 0.75rem 0.5rem;
    }
    
    .pattern-icon {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .body-part {
        stroke-width: 2 !important;
    }
    
    .body-map-nav button {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .selected-parts-badge .remove-part {
        min-width: 36px;
        min-height: 36px;
        font-size: 1.3rem;
    }
    
    .pain-scale-option label {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }
    
    .pain-pattern-option .form-check-label,
    .characteristic-option .form-check-label {
        padding: 1.25rem;
    }
}

@media (forced-colors: active) {
    .body-part {
        stroke: ButtonText !important;
    }
    
    .body-part.selected {
        fill: Highlight !important;
    }
} 