/* ============================================================================
   Valoraciones Preoperatorias - CSS Styles
   Minimalista, elegante, rápida carga, espacios publicitarios optimizados
   ============================================================================ */

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1F2937;
    background: linear-gradient(135deg, #1E3A5F 0%, #3D5A80 100%);
    min-height: 100vh;
    font-size: 16px;
}

/* Skip link para accesibilidad */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Header y navegación - Compacto */
.header {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.5rem 0;
    /* Reducido de 1rem a 0.5rem */
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1400px;
    /* Aumentado para aprovechar más espacio */
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.3rem;
    /* Reducido de 1.5rem */
    font-weight: 300;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    /* Reducido de 2rem */
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0.3rem 0.8rem;
    /* Reducido padding */
    border-radius: 4px;
    font-size: 0.9rem;
    /* Añadido tamaño de fuente más pequeño */
}

.nav-menu a:hover,
.nav-menu a:focus {
    color: #F5D77A;
    background: rgba(255, 255, 255, 0.1);
}

/* Layout principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-height: 80vh;
}

/* Hero section */
.hero {
    background: linear-gradient(135deg, #1E3A5F, #3D5A80);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero * {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Disclaimer */
.disclaimer {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    color: #856404;
    font-size: 0.9rem;
    text-align: left;
}

/* Secciones */
.form-section,
.scales-container,
.results-container,
.info-section {
    padding: 2rem;
}

.form-section h2,
.scales-container h2,
.results-container h2,
.info-section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    position: relative;
}

.form-section h2::after,
.scales-container h2::after,
.results-container h2::after,
.info-section h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #1E3A5F, #3D5A80);
    border-radius: 2px;
}

/* Formularios */
.patient-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3D5A80;
    box-shadow: 0 0 0 3px rgba(61, 90, 128, 0.15);
}

.form-group select:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Estilos específicos para dropdowns de cirugía */
#surgery-type,
#specific-surgery {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

#surgery-type:focus,
#specific-surgery:focus {
    border-color: #3D5A80;
    box-shadow: 0 0 0 3px rgba(61, 90, 128, 0.15);
}

/* Animación suave para el dropdown específico */
#specific-surgery {
    transition: opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

#specific-surgery:disabled {
    opacity: 0.5;
    background-color: #f1f3f4;
}

/* Hover effects para dropdowns */
#surgery-type:hover:not(:disabled),
#specific-surgery:hover:not(:disabled) {
    border-color: #9ca3af;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Estilos para opciones del dropdown */
#specific-surgery option:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    font-style: italic;
    font-weight: 500;
}

#specific-surgery option:not(:disabled) {
    padding: 8px 12px;
}

/* Indicador de dropdown activo */
.form-group.dropdown-active select {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.form-group input:invalid,
.form-group select:invalid {
    border-color: #dc3545;
}

.help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #6c757d;
}

/* Botones */
.btn-primary,
.btn-process,
.btn-secondary {
    background: linear-gradient(135deg, #1E3A5F, #3D5A80);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    margin: 1rem auto;
    min-width: 200px;
}

.btn-primary:disabled {
    background: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:hover:not(:disabled),
.btn-process:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 58, 95, 0.35);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    margin: 0.5rem;
    min-width: 150px;
    font-size: 14px;
    padding: 10px 20px;
}

.btn-icon {
    font-size: 1.1em;
}

/* Loading y processing */
.loading,
.processing {
    text-align: center;
    padding: 2rem;
    color: #1E3A5F;
}

.loading-spinner,
.processing-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1E3A5F;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Escalas */
.scales-content {
    display: grid;
    gap: 1.5rem;
}

.scale-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid #1E3A5F;
    transition: all 0.3s ease;
}

.scale-item.missing {
    border-left-color: #dc3545;
    position: relative;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15);
}

.scale-item.missing::after {
    content: '⚠️ Falta completar';
    position: absolute;
    top: 8px;
    right: 12px;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    padding: 4px 6px;
    border-radius: 6px;
    letter-spacing: .5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.scale-missing-note {
    background: #fff5f5;
    border: 1px solid #f8d7da;
    color: #b71c1c;
    font-size: .75rem;
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scale-missing-note::before {
    content: '⛔';
    font-size: .9rem;
}

.scale-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* Auto-filled notice */
.auto-filled-notice {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border: 1px solid #bbdefb;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.notice-icon {
    font-size: 1.5rem;
    line-height: 1;
    margin-top: 2px;
}

.notice-text {
    flex: 1;
    color: #1976d2;
    font-size: 0.95rem;
    line-height: 1.4;
}

.notice-text strong {
    color: #0d47a1;
    font-weight: 600;
}

.scale-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.scale-description {
    color: #6c757d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.scale-fields {
    display: grid;
    gap: 1rem;
}

.scale-field {
    display: flex;
    flex-direction: column;
}

.scale-field label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.scale-field input,
.scale-field select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
}

/* Checkbox styles */
.checkbox-field {
    display: block !important;
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin: 0.5rem 0;
}

.checkbox-input {
    display: none;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: #495057;
    line-height: 1.4;
    margin-bottom: 0 !important;
}

.checkbox-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    background: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
}

/* Checkmark usando pseudo-elemento */
.checkbox-box::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    opacity: 0;
    transition: all 0.2s ease;
    top: 2px;
    left: 6px;
}

.checkbox-check {
    width: 14px;
    height: 14px;
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.checkbox-text {
    flex: 1;
    padding-right: 8px;
}

/* Checkbox states */
.checkbox-input:checked+.checkbox-box {
    background: #1E3A5F;
    border-color: #1E3A5F;
    transform: scale(1.05);
}

.checkbox-input:checked+.checkbox-box::after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

.checkbox-input:checked~.checkbox-check {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label:hover .checkbox-box {
    border-color: #3D5A80;
    box-shadow: 0 0 0 2px rgba(61, 90, 128, 0.1);
}

.checkbox-input:focus+.checkbox-box {
    outline: none;
    border-color: #3D5A80;
    box-shadow: 0 0 0 3px rgba(61, 90, 128, 0.2);
}

/* Animation for check mark */
@keyframes checkmark {
    0% {
        opacity: 0;
        transform: rotate(45deg) scale(0);
    }

    50% {
        opacity: 1;
        transform: rotate(45deg) scale(1.1);
    }

    100% {
        opacity: 1;
        transform: rotate(45deg) scale(1);
    }
}

.checkbox-input:checked+.checkbox-box::after {
    animation: checkmark 0.3s ease;
}

.checkbox-input:checked~.checkbox-check {
    animation: checkmark 0.3s ease;
}

/* ============================================================================
   Radio Button Custom Styles
   ============================================================================ */

/* Ocultar el input radio nativo */
.radio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Contenedor de cada opción de radio */
.radio-container {
    display: flex;
    align-items: flex-start;
    margin: 0.25rem 0;
}

/* Label del radio */
.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    background: #f8f9fa;
    width: 100%;
}

.radio-label:hover {
    background: rgba(30, 58, 95, 0.08);
    border-color: rgba(61, 90, 128, 0.2);
}

/* Círculo del radio */
.radio-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    background: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
}

/* Indicador interno del radio (punto) */
.radio-circle::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    transform: scale(0);
    opacity: 0;
    transition: all 0.2s ease;
}

/* Radio text */
.radio-text {
    flex: 1;
    font-weight: 500;
    color: #495057;
    line-height: 1.4;
}

/* Estados del radio cuando está seleccionado */
.radio-input:checked+.radio-label {
    background: rgba(30, 58, 95, 0.12);
    border-color: #3D5A80;
}

.radio-input:checked+.radio-label .radio-circle {
    background: #1E3A5F;
    border-color: #1E3A5F;
    transform: scale(1.05);
}

.radio-input:checked+.radio-label .radio-circle::after {
    opacity: 1;
    transform: scale(1);
}

.radio-input:checked+.radio-label .radio-text {
    color: #2c3e50;
    font-weight: 600;
}

/* Focus state */
.radio-input:focus+.radio-label {
    outline: none;
    box-shadow: 0 0 0 3px rgba(61, 90, 128, 0.25);
}

.radio-input:focus+.radio-label .radio-circle {
    border-color: #3D5A80;
}

/* Hover on circle */
.radio-label:hover .radio-circle {
    border-color: #3D5A80;
    box-shadow: 0 0 0 2px rgba(61, 90, 128, 0.1);
}

/* Animación para el indicador del radio */
@keyframes radioSelect {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.radio-input:checked+.radio-label .radio-circle::after {
    animation: radioSelect 0.25s ease;
}

/* Estilo especial para opción "Ninguno" en radios */
.radio-none-label {
    background: #f8f9fa;
    border-style: dashed;
}

.radio-none-label .radio-text {
    color: #6c757d;
    font-style: italic;
}

.radio-input:checked+.radio-none-label {
    background: rgba(108, 117, 125, 0.1);
    border-color: #6c757d;
}

.radio-input:checked+.radio-none-label .radio-circle {
    background: #6c757d;
    border-color: #6c757d;
}

/* --------------------------------------------------------------------------
   Radio groups layout and 'Ninguno' styling
   Improves spacing, alignment and interaction feedback for radio groups
   ----------------------------------------------------------------------- */
.radio-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    /* allows radios to wrap on small screens */
}

.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.08s ease;
    user-select: none;
}

.radio-option input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.radio-option:hover {
    background: rgba(102, 126, 234, 0.06);
}

.radio-option.selected {
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.08);
}

/* 'Ninguno' visual treatment (subtle / muted) */
.radio-none-label {
    color: #6c757d;
    /* muted gray */
}

.radio-none-selected {
    color: #6c757d;
    font-style: italic;
    background: rgba(0, 0, 0, 0.03);
    border: 1px dashed rgba(108, 117, 125, 0.12);
}

/* For selects that have the 'none' value selected */
select.select-none-selected {
    color: #6c757d;
}

/* ============================================================================
   Barra de Progreso de Completación
   ============================================================================ */

.completion-progress {
    margin: 2rem auto;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    transition: all 0.3s ease;
}

.completion-progress.ready {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.completion-progress.complete {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.progress-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #dc3545;
    transition: all 0.4s ease;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.3) 50%,
            rgba(255, 255, 255, 0) 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    font-weight: 700;
    color: #2c3e50;
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

.progress-info {
    text-align: center;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Estados de color de la barra */
.completion-progress.ready .progress-fill {
    background: linear-gradient(135deg, #ffc107, #ff9800);
}

.completion-progress.complete .progress-fill {
    background: linear-gradient(135deg, #28a745, #20c997);
}

/* Responsive para la barra de progreso */
@media (max-width: 768px) {
    .completion-progress {
        margin: 1.5rem 1rem;
        padding: 1rem;
    }

    .progress-label {
        font-size: 0.9rem;
    }

    .progress-bar {
        height: 20px;
    }

    .progress-text {
        font-size: 1rem;
    }
}

/* Resultados */
.results-content {
    display: grid;
    gap: 1.5rem;
}

.result-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #28a745;
}

.result-item.high-risk,
.result-item.alto-risk {
    border-left-color: #dc3545;
}

.result-item.moderate-risk,
.result-item.intermedio-risk {
    border-left-color: #ffc107;
}

.result-item.low-risk,
.result-item.bajo-risk {
    border-left-color: #28a745;
}

.result-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.risk-level {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

.risk-low,
.risk-bajo {
    background: #d4edda;
    color: #155724;
}

.risk-moderate,
.risk-intermedio {
    background: #fff3cd;
    color: #856404;
}

.risk-high,
.risk-alto {
    background: #f8d7da;
    color: #721c24;
}

.results-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

/* Información */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    color: #C9A227;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    background: #1a252f;
    text-align: center;
    padding: 1rem;
    color: #bdc3c7;
    font-size: 0.9rem;
}

/* Responsive Design - Mobile First Approach */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
        max-width: 100%;
        padding: 15px;
    }

    .footer-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {

    /* Navigation optimizations */
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-menu {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-menu li a {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Hero section */
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Form optimizations */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-group label {
        font-size: 0.9rem;
        font-weight: 600;
    }

    .form-group input,
    .form-group select {
        padding: 0.875rem;
        font-size: 1rem;
        min-height: 44px;
        /* Touch target minimum */
    }

    /* Buttons */
    .btn-primary,
    .btn-process {
        width: 100%;
        margin: 1rem 0;
        padding: 1rem;
        font-size: 1rem;
        min-height: 44px;
    }

    /* Scale items */
    .scale-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .scale-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .scale-description {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    .scale-field {
        margin-bottom: 1rem;
    }

    .scale-field label {
        font-size: 0.9rem;
        line-height: 1.4;
        display: block;
        margin-bottom: 0.5rem;
    }

    .scale-field input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 0.75rem;
    }

    .scale-field input[type="radio"] {
        width: 18px;
        height: 18px;
        margin-right: 0.75rem;
    }

    /* Results section */
    .result-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .result-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .result-score {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }

    .risk-level {
        display: block;
        margin-top: 0.5rem;
        padding: 0.5rem;
        text-align: center;
        border-radius: 4px;
    }

    .results-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .results-actions button {
        width: 100%;
        padding: 0.875rem;
        min-height: 44px;
    }

    /* Container and layout */
    .container {
        padding: 10px;
        max-width: 100%;
    }

    .form-section,
    .scales-container,
    .results-container,
    .info-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Advertisements */
    .ad-placeholder[data-ad-size="728x90"] {
        width: 100%;
        max-width: 728px;
        height: auto;
        min-height: 90px;
    }

    /* Disclaimer */
    .disclaimer {
        font-size: 0.85rem;
        padding: 1rem;
        margin: 1rem 0;
    }

    /* Loading indicators */
    .loading {
        padding: 2rem 1rem;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {

    /* Extra small screens */
    .hero {
        padding: 1.5rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    /* Form elements even more touch-friendly */
    .form-group input,
    .form-group select {
        padding: 1rem;
        font-size: 1.1rem;
        min-height: 48px;
    }

    .btn-primary,
    .btn-process {
        padding: 1.25rem;
        font-size: 1.1rem;
        min-height: 48px;
        margin: 1.5rem 0;
    }

    /* Scale fields more spaced */
    .scale-field {
        margin-bottom: 1.5rem;
        padding: 0.75rem;
        background: rgba(0, 0, 0, 0.02);
        border-radius: 8px;
    }

    .scale-field label {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .scale-field input[type="checkbox"],
    .scale-field input[type="radio"] {
        width: 22px;
        height: 22px;
        margin-right: 1rem;
    }

    /* Checkbox and radio labels */
    .checkbox-label,
    .radio-label {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.5rem;
        cursor: pointer;
        border-radius: 6px;
        transition: background-color 0.2s;
    }

    .checkbox-label:hover,
    .radio-label:hover {
        background-color: rgba(0, 123, 255, 0.1);
    }

    /* Estilos para la opción "Ninguno" (atenuada) */
    .radio-none-label {
        color: #6c757d;
        /* gris apagado para indicar no aplicable */
    }

    /* Cuando la opción 'Ninguno' está seleccionada, marcar la label como seleccionada pero atenuada */
    .radio-none-selected {
        color: #6c757d;
        font-style: italic;
        background: rgba(0, 0, 0, 0.02);
    }

    /* Para selects: aplicar color atenuado cuando está seleccionado 'none' */
    select.select-none-selected {
        color: #6c757d;
    }

    /* Result items more readable */
    .result-item {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .result-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .result-interpretation,
    .result-risk,
    .result-details,
    .result-recommendations {
        margin-bottom: 1rem;
        font-size: 0.95rem;
        line-height: 1.5;
    }

    /* Navigation more touch-friendly */
    .nav-menu li a {
        padding: 1rem 2rem;
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Error and success messages */
    .error-message,
    .success-message {
        padding: 1rem;
        font-size: 0.95rem;
        margin: 1rem 0;
        border-radius: 8px;
    }

    /* Auto-filled notice */
    .auto-filled-notice {
        padding: 1rem;
        margin: 1rem 0;
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* Touch improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* This targets touch devices */

    button,
    input[type="submit"],
    input[type="button"],
    .btn-primary,
    .btn-process {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }

    select {
        min-height: 44px;
        padding: 0.75rem;
    }

    input[type="checkbox"],
    input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
    }

    /* Larger touch targets for interactive elements */
    .scale-field label {
        min-height: 44px;
        display: flex;
        align-items: center;
        cursor: pointer;
    }

    /* Remove hover effects on touch devices */
    button:hover,
    .btn-primary:hover,
    .btn-process:hover {
        transform: none;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 1rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .scale-fields {
        columns: 2;
        column-gap: 1rem;
    }

    .scale-field {
        break-inside: avoid;
        margin-bottom: 0.75rem;
    }
}

/* Mobile-specific utility classes */
.mobile-device {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.extra-small-screen .container {
    padding: 5px;
}

.short-viewport .hero {
    padding: 1rem 0;
}

/* CSS Custom Properties for dynamic viewport */
:root {
    --vh: 1vh;
}

/* Touch-friendly improvements */
.mobile-device button,
.mobile-device select,
.mobile-device input {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
}

.mobile-device .scale-field label {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Prevent text selection on touch */
.mobile-device .btn-primary,
.mobile-device .btn-process,
.mobile-device button {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Improve checkbox and radio visibility on mobile */
@media (max-width: 768px) {

    input[type="checkbox"],
    input[type="radio"] {
        transform: scale(1.2);
        margin: 0.5rem;
    }

    .scale-field input[type="checkbox"]+label,
    .scale-field input[type="radio"]+label {
        padding-left: 0.5rem;
        line-height: 1.6;
    }
}

/* iOS specific improvements */
@supports (-webkit-touch-callout: none) {

    /* iOS devices */
    .mobile-device input,
    .mobile-device select,
    .mobile-device textarea {
        font-size: 16px !important;
        /* Prevent zoom */
    }

    .mobile-device .form-group select {
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
        padding-right: 3rem;
    }
}

/* Android specific improvements */
@media screen and (-webkit-min-device-pixel-ratio: 2) {

    /* High DPI Android devices */
    .mobile-device {
        text-rendering: optimizeLegibility;
    }
}

/* Safe area insets for devices with notches */
@supports (padding: max(0px)) {

    .header,
    .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .hero {
        padding-top: max(2rem, env(safe-area-inset-top));
    }
}

.scales-container,
.results-container {
    contain: layout;
}

.ad-placeholder {
    contain: size layout;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .loading-spinner {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .result-item {
        border: 2px solid;
    }

    .btn-primary,
    .btn-process {
        border: 2px solid;
    }

    .scale-field input {
        border: 2px solid;
    }
}

/* Footer - Nuevo espacio inferior */
.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.footer-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.footer-section h3 {
    color: #C9A227;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: #C9A227;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 2rem;
    margin-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Print styles */
@media print {

    .header,
    .results-actions,
    .footer {
        display: none !important;
    }

    body {
        background: white;
    }

    .main-content {
        box-shadow: none;
        border-radius: 0;
    }

    .container {
        max-width: none;
    }
}