/*
 * 🗺️ PLANNER - SISTEMA DE DISEÑO XACOBEOS
 * Estilos específicos para el planificador de rutas
 */

/* ================================
   PLANNER CONTAINER
   ================================ */
.planner-container {
    max-width: var(--max-width-site);
    margin: 0 auto;
    padding: 2rem var(--padding-container);
}

/* ================================
   PLANNER HEADER - MEJORADO
   ================================ */
.planner-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(44, 90, 160, 0.05) 0%, rgba(255, 208, 2, 0.08) 100%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.planner-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--xacobeos-blue), var(--camino-yellow));
}

.planner-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--xacobeos-blue);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-family: var(--font-headings);
}

.planner-header p {
    font-size: 1.05rem;
    color: var(--gray-600);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ================================
   PLANNER FORM - SISTEMA DE DISEÑO
   ================================ */
.planner-form-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 3rem;
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.planner-form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--xacobeos-blue), var(--camino-yellow));
}

.planner-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Reducido de 1rem */
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem; /* Reducido de 1rem */
}

/* Los estilos de .form-group, .form-label, .form-input, .form-select 
   ahora se heredan del sistema de diseño en forms.css */

/* ================================
   PLAN TYPE FIELDSET - SISTEMA DE DISEÑO
   ================================ */
.plan-type-fieldset {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md); /* Reducido de var(--radius-lg) */
    padding: 1rem; /* Reducido de 1.5rem */
    background: var(--gray-50);
}

.plan-type-fieldset legend {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 1rem; /* Reducido de 1.1rem */
    padding: 0 0.75rem; /* Reducido de 1rem */
}

.plan-type-chooser {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Reducido de 200px */
    gap: 0.75rem; /* Reducido de 1rem */
    margin-top: 0.75rem; /* Reducido de 1rem */
}

/* Los estilos de .form-radio-label ahora se heredan del sistema de diseño */
.plan-type-chooser .form-radio-label {
    padding: 0.75rem; /* Reducido de 1rem */
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md); /* Reducido de var(--radius-md) */
    background: var(--white);
    transition: var(--transition-fast);
    font-weight: 500;
    font-size: 0.875rem; /* Más compacto */
}

.plan-type-chooser .form-radio-label:hover {
    border-color: var(--camino-blue);
    background: var(--gray-50);
}

.plan-type-chooser .form-radio:checked + span {
    color: var(--camino-blue);
    font-weight: 600;
}

/* ================================
   FORM ACTIONS
   ================================ */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.form-actions .btn {
    font-weight: 600;
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    border: 2px solid transparent;
    cursor: pointer;
}

.form-actions .btn-primary {
    background: linear-gradient(135deg, var(--xacobeos-blue), var(--xacobeos-blue-light));
    color: var(--white);
    border-color: var(--xacobeos-blue);
    position: relative;
    overflow: hidden;
}

.form-actions .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--camino-yellow), transparent);
    opacity: 0.3;
    transition: left 0.5s ease;
}

.form-actions .btn-primary:hover {
    background: linear-gradient(135deg, var(--xacobeos-blue-light), var(--xacobeos-blue));
    border-color: var(--camino-yellow);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.3);
}

.form-actions .btn-primary:hover::before {
    left: 100%;
}

.form-actions .btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.form-actions .btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ================================
   RESULTS SECTION
   ================================ */
#planner-results {
    margin-top: 3rem;
}

.results-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 2rem;
}

.plan-summary {
    background: linear-gradient(135deg, rgba(44, 90, 160, 0.03), rgba(255, 208, 2, 0.03));
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.plan-summary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--xacobeos-blue), var(--camino-yellow));
}

.plan-summary p {
    font-size: 1.125rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0;
}

.plan-summary strong {
    color: var(--xacobeos-blue);
    font-weight: 600;
}

/* ================================
   ERROR RESULTS
   ================================ */
.error-results {
    border-left: 4px solid var(--error);
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
}

.error-message h3 {
    color: var(--error);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.error-message p {
    color: var(--gray-700);
    margin-bottom: 1.5rem;
}

.error-suggestions {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1rem;
}

.error-suggestions h4 {
    color: var(--gray-800);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.error-suggestions ul {
    list-style: none;
    padding: 0;
}

.error-suggestions li {
    padding: 0.5rem 0;
    color: var(--gray-700);
    position: relative;
    padding-left: 1.5rem;
}

.error-suggestions li::before {
    content: '💡';
    position: absolute;
    left: 0;
    top: 0.5rem;
}

/* ================================
   DAILY PLAN
   ================================ */
.daily-plan {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.day-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.day-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--xacobeos-blue), var(--camino-yellow));
}

.day-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 208, 2, 0.1), transparent);
    border-radius: 50%;
    transform: translate(50%, -50%);
    pointer-events: none;
}

.day-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: var(--camino-yellow);
}

.day-card:focus-within {
    outline: 2px solid var(--camino-blue);
    outline-offset: 2px;
}

.day-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.day-card h3 {
    color: var(--xacobeos-blue);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-headings);
}

.day-number {
    background: linear-gradient(135deg, var(--xacobeos-blue), var(--xacobeos-blue-light));
    color: var(--white);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.3);
    position: relative;
}

.day-number::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, var(--camino-yellow), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.day-card:hover .day-number::after {
    opacity: 1;
}

.day-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.day-card p {
    margin-bottom: 1rem;
    color: var(--gray-700);
    line-height: 1.6;
}

.route-summary {
    background: linear-gradient(135deg, rgba(255, 208, 2, 0.08), rgba(255, 208, 2, 0.02));
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--camino-yellow);
    box-shadow: 0 2px 8px rgba(255, 208, 2, 0.1);
    position: relative;
}

.route-summary::before {
    content: '📍';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    opacity: 0.3;
}

.route-summary strong {
    color: var(--gray-800);
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.duration-estimates {
    margin: 1.5rem 0;
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--gray-200);
}

.duration-estimates strong {
    display: block;
    margin-bottom: 1rem;
    color: var(--gray-800);
    font-size: 1.1rem;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

.duration-estimates ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.duration-estimates li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-radius: var(--radius-md);
    font-weight: 500;
    border: 1px solid var(--gray-200);
    transition: var(--transition-fast);
    position: relative;
}

.duration-estimates li:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.duration-estimates .emoji {
    font-size: 1.4rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.duration-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--gray-700);
}

/* ================================
   DETAILS SECTION - HITOS INTERMEDIOS
   ================================ */
.intermediate-hitos {
    margin: 1.5rem 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.intermediate-hitos summary {
    cursor: pointer;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0;
    font-weight: 600;
    color: var(--gray-700);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.intermediate-hitos summary:hover {
    background: var(--gray-100);
}

.intermediate-hitos summary:focus {
    outline: 2px solid var(--camino-blue);
    outline-offset: -2px;
}

.intermediate-hitos[open] summary {
    background: linear-gradient(135deg, var(--xacobeos-blue), var(--xacobeos-blue-light));
    color: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.hitos-count {
    background: var(--camino-yellow);
    color: var(--gray-900);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(255, 208, 2, 0.3);
}

.intermediate-hitos[open] .hitos-count {
    background: var(--white);
    color: var(--xacobeos-blue);
    box-shadow: 0 2px 4px rgba(44, 90, 160, 0.2);
}

.hitos-list {
    list-style: none;
    padding: 0;
    background: var(--white);
    margin: 0;
}

.hito-item {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition-fast);
}

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

.hito-item:hover {
    background: var(--gray-50);
}

.hito-name {
    display: block;
    color: var(--gray-800);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.hito-duration-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.duration-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    background: var(--gray-50);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.duration-item span[aria-label] {
    font-size: 1rem;
}

/* ================================
   MAPS AND CHARTS
   ================================ */
.stage-map-container {
    margin: 2rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stage-map {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

/* ================================
   ALTITUDE PROFILE
   ================================ */
.altitude-profile-container {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: visible;
}

.altitude-profile-header {
    margin-bottom: 1rem;
}

.altitude-profile-header h4 {
    margin: 0 0 0.5rem 0;
    color: var(--gray-800);
    font-size: 1.1rem;
    font-weight: 600;
}

.altitude-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.altitude-stats .stat {
    background: linear-gradient(135deg, var(--gray-50), var(--white));
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    font-weight: 500;
    color: var(--gray-700);
    transition: var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.altitude-stats .stat:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border-color: var(--camino-blue);
}

.altitude-chart-container {
    position: relative;
    height: 350px;
    margin-top: 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 1px solid var(--gray-200);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.altitude-profile-error {
    background: var(--error);
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: var(--white);
    text-align: center;
    font-weight: 500;
}

/* ================================
   CHART CONTROLS
   ================================ */
/* Controles de zoom eliminados por simplicidad de interfaz */

/* ================================
   HITO INFO POPUP
   ================================ */
.hito-info-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--radius-lg);
    padding: 0;
    backdrop-filter: blur(10px);
    animation: popupFadeIn 0.3s ease-out;
}

.hito-popup-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 400px;
    min-width: 300px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.hito-popup-content h4 {
    margin: 0 0 1rem 0;
    color: var(--gray-800);
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 2px solid var(--camino-yellow);
    padding-bottom: 0.5rem;
}

.hito-popup-content p {
    margin: 0.75rem 0;
    color: var(--gray-600);
    font-size: 1rem;
    line-height: 1.5;
}

.hito-popup-content p strong {
    color: var(--gray-800);
    font-weight: 600;
}

.hito-popup-content button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--error);
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    color: var(--white);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hito-popup-content button:hover {
    background: #c0392b;
    transform: scale(1.1);
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ================================
   CHART ENHANCEMENTS
   ================================ */
.altitude-chart-container canvas {
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.altitude-chart-container:hover canvas {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ================================
   RESPONSIVE
   ================================ */

/* Tablets y pantallas medianas */
@media (max-width: 1024px) {
    .planner-container {
        max-width: 100%;
    }
    
    .daily-plan {
        gap: 1.5rem;
    }
    
    .day-card {
        min-height: auto;
    }
}

/* Tablets pequeñas */
@media (max-width: 768px) {
    .planner-container {
        padding: 1rem;
    }
    
    .planner-header {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .planner-form-container {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .plan-type-chooser {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-actions .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .day-card {
        padding: 1.5rem;
    }
    
    .day-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .duration-estimates ul {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .altitude-stats {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .altitude-chart-container {
        height: 250px;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .planner-container {
        padding: 0.5rem;
    }
    
    .planner-header {
        padding: 1.5rem 1rem;
    }
    
    .planner-header h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .planner-header p {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .planner-form-container {
        padding: 1rem;
    }
    
    .results-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .day-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .day-card h3 {
        font-size: 1.25rem;
    }
    
    .day-number {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
    
    .duration-estimates {
        padding: 0.75rem;
    }
    
    .duration-estimates li {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .duration-estimates .emoji {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 1.2rem;
    }
    
    .altitude-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .altitude-stats .stat {
        text-align: center;
        padding: 0.75rem;
    }
    
    .altitude-chart-container {
        height: 200px;
    }
    
    .stage-map {
        height: 250px !important;
    }
}

/* ================================
   ACCESIBILIDAD WCAG
   ================================ */

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .day-card {
        border: 2px solid var(--gray-800);
    }
    
    .day-card::before {
        height: 6px;
    }
    
    .duration-estimates li {
        border: 2px solid var(--gray-600);
    }
}

/* Reducir movimiento para usuarios sensibles */
@media (prefers-reduced-motion: reduce) {
    .day-card,
    .duration-estimates li,
    .form-actions .btn {
        transition: none;
    }
    
    .day-card:hover,
    .duration-estimates li:hover,
    .form-actions .btn:hover {
        transform: none;
    }
}

/* Mejoras de foco para navegación por teclado */
.day-card:focus-within,
.duration-estimates li:focus-within,
select:focus,
input:focus,
button:focus {
    outline: 3px solid var(--camino-blue);
    outline-offset: 2px;
}

/* Texto más legible */
.day-card p,
.duration-text,
.altitude-stats .stat {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    line-height: 1.6;
}

/* Área de toque más grande en móviles */
@media (max-width: 768px) {
    button,
    select,
    summary {
        min-height: 44px;
        min-width: 44px;
    }
    
    .duration-estimates li {
        min-height: 60px;
    }
}