/**
 * WHOQOL-BREF Demo Styles
 * Estilos específicos para la escala de calidad de vida WHOQOL-BREF
 * Autor: Dr. Mauricio Villamandos
 */

/* ==========================================================================
   Hero Section - WHOQOL-BREF Specific
   ========================================================================== */

.hero-section {
    background: linear-gradient(135deg, var(--primary-gradient));
    border: none;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.hero-icon {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.hero-meta .badge {
    margin: 0 0.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ==========================================================================
   Patient Data Section
   ========================================================================== */

.patient-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.patient-card__header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.patient-card__title {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Quality of Life Instructions
   ========================================================================== */

.qol-instructions {
    background: linear-gradient(135deg, var(--info-bg), var(--info-bg-secondary));
    border: 1px solid var(--info-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.qol-instructions::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--info-color);
}

.qol-instructions h4 {
    color: var(--info-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qol-instructions .instruction-text {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.scale-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--info-border);
}

.scale-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
}

/* ==========================================================================
   Domain Sections
   ========================================================================== */

.domain-section {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.domain-header {
    background: linear-gradient(135deg, var(--primary-gradient));
    color: var(--text-primary);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.domain-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.domain-subtitle {
    opacity: 0.9;
    margin: 0;
    font-size: 0.9rem;
}

.domain-content {
    padding: 1.5rem;
}

/* ==========================================================================
   Question Blocks
   ========================================================================== */

.question-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.question-block:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.question-header {
    margin-bottom: 1rem;
}

.question-number {
    background: var(--primary-color);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 0.75rem;
}

.question-text {
    display: inline;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ==========================================================================
   Response Options
   ========================================================================== */

.response-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.response-option {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    padding-left: 2rem; /* Espacio extra para el radio button */
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.response-option:hover {
    border-color: var(--primary-color);
    background: var(--primary-bg);
    transform: translateY(-2px);
}

.response-option input[type="radio"] {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    opacity: 1;
    margin: 0;
    cursor: pointer;
    z-index: 2;
    accent-color: var(--primary-color);
    transform: scale(1.2);
}

.response-option input[type="radio"]:checked {
    accent-color: var(--primary-color);
}

.response-option:has(input[type="radio"]:checked) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.response-option input[type="radio"]:checked + .option-content,
.response-option input[type="radio"]:checked ~ * {
    color: white;
}

.response-option:has(input[type="radio"]:checked) {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.option-content {
    transition: color 0.3s ease;
    pointer-events: none; /* Permite que el click pase al radio button */
}

.option-value {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.option-label {
    font-size: 0.8rem;
    opacity: 0.9;
    line-height: 1.2;
}

/* Mejoras para visibilidad de radio buttons */
.response-option label {
    cursor: pointer;
    display: block;
    position: relative;
}

.response-option input[type="radio"]:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Fallback para navegadores que no soporten :has() */
.response-option.selected {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.response-option.selected .option-content,
.response-option.selected .option-value,
.response-option.selected .option-label {
    color: white;
}

/* ==========================================================================
   Progress Section
   ========================================================================== */

.progress-section {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    position: sticky;
    top: 120px;
    z-index: 10;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.progress-counter {
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-bar-container {
    position: relative;
}

.progress {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.5s ease;
}

/* ==========================================================================
   Results Panel
   ========================================================================== */

.results-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.results-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.results-title {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.domain-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.domain-score-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.domain-score-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.domain-score-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.domain-score-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.domain-score-max {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.total-score {
    background: linear-gradient(135deg, var(--primary-gradient));
    color: white;
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.total-score-label {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.total-score-value {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.total-score-interpretation {
    font-size: 1rem;
    opacity: 0.9;
}

/* ==========================================================================
   Chart Container
   ========================================================================== */

.chart-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.chart-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.action-button {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-button--primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.action-button--secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.action-button--secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ==========================================================================
   Interpretation Section
   ========================================================================== */

.interpretation-section {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.interpretation-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.interpretation-content {
    line-height: 1.7;
    color: var(--text-primary);
}

.interpretation-domains {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.interpretation-domain {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.interpretation-domain-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.interpretation-domain-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .response-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .domain-scores {
        grid-template-columns: 1fr;
    }
    
    .patient-card,
    .domain-content {
        padding: 1rem;
    }
    
    .total-score {
        padding: 1.5rem;
    }
    
    .total-score-value {
        font-size: 2.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-button {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .response-options {
        grid-template-columns: 1fr;
    }
    
    .response-option {
        min-height: 50px;
    }
    
    .scale-legend {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .hero-meta .badge {
        display: block;
        margin: 0.25rem 0;
    }
}

/* ==========================================================================
   Theme-specific adjustments
   ========================================================================== */

[data-theme="dark"] .question-block {
    background: var(--glass-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .response-option {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .domain-score-card {
    background: var(--glass-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .chart-container {
    background: var(--glass-bg);
    border-color: var(--border-color);
}

/* ==========================================================================
   HCPE Form Styles - Standardized Patient Data Section
   ========================================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.voice-controls {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.voice-controls .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.3s ease;
}

.voice-controls .btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.voice-controls .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.voice-controls .btn-outline-secondary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

#vozSelect {
    max-width: 200px;
    font-size: 0.75rem;
}

/* Dark mode adjustments for HCPE forms */
[data-theme="dark"] .form-control {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-secondary);
}

[data-theme="dark"] .voice-controls .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .voice-controls .btn-outline-secondary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Responsive adjustments for HCPE forms */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .voice-controls {
        flex-wrap: wrap;
    }
    
    #vozSelect {
        max-width: 100%;
        margin-top: 0.5rem;
    }
}