/* ============================================
   ESTILOS RESPONSIVE PARA SISTEMA DE VOTACIÓN
   ============================================ */

/* Variables CSS para fácil personalización */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --border-color: #ced4da;
    --focus-color: #80bdff;
    --bg-white: rgba(255, 255, 255, 0.95);
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

/* Reset y configuración base */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 25%, #0d47a1 50%, #01579b 75%, #004d40 100%);
    background-attachment: fixed;
    position: relative;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin: 0;
    padding: 1rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Overlay con degradado azul intenso */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(21, 101, 192, 0.25));
    z-index: 1;
    pointer-events: none;
}

/* ============================================
   CONTENEDOR PRINCIPAL DEL FORMULARIO
   ============================================ */
.form-container {
    position: relative;
    z-index: 2;
    background: var(--bg-white);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    max-width: 550px;
    width: 100%;
    margin: 2rem auto;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   HEADER - Logo y Título
   ============================================ */
.header-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
}

.logo-wrapper {
    flex-shrink: 0;
}

.header-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
}

.header-text {
    flex: 1;
}

.main-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0 0;
    line-height: 1.4;
}

/* ============================================
   ENCABEZADO DEL FORMULARIO
   ============================================ */
.form-header {
    text-align: center;
    margin-bottom: 1rem;
}

.form-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-subtitle {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 0;
}

.separator {
    margin: 1.5rem 0;
    border-color: rgba(0, 0, 0, 0.1);
}

.instruction-text {
    text-align: center;
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: rgba(0, 123, 255, 0.05);
    border-radius: 8px;
}

/* ============================================
   CAMPO DE ENTRADA RUT
   ============================================ */
.input-group-text {
    background-color: #f8f9fa;
    border-right: none;
    padding: 0.75rem 1rem;
}

.input-group-text i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.form-control {
    border-left: none;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: var(--transition);
}

.input-lg {
    font-size: 1.25rem !important;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.input-lg::placeholder {
    font-weight: 400;
    color: #adb5bd;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--focus-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
    outline: none;
}

.input-group:focus-within .input-group-text {
    border-color: var(--focus-color);
    background-color: rgba(0, 123, 255, 0.05);
}

.input-group:focus-within .form-control {
    border-left: none;
}

.form-text {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* ============================================
   BOTÓN DE ENVÍO
   ============================================ */
.submit-btn {
    background: linear-gradient(135deg, var(--primary-color), #0069d9);
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), #0056b3);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 123, 255, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

/* ============================================
   FOOTER
   ============================================ */
.form-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.form-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ============================================
   RESPONSIVE - TABLETS
   ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    body {
        padding: 0.5rem;
    }

    .form-container {
        padding: 1.5rem;
        margin: 1rem auto;
        border-radius: 12px;
    }

    .header-container {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .header-logo {
        max-width: 150px;
    }

    .main-title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .form-title {
        font-size: 1.15rem;
    }

    .form-subtitle {
        font-size: 1rem;
    }

    .submit-btn {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
}

/* ============================================
   RESPONSIVE - MÓVILES
   ============================================ */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    body {
        padding: 0.25rem;
        align-items: flex-start;
    }

    .form-container {
        padding: 1.25rem;
        margin: 0.5rem auto;
        border-radius: 10px;
        max-width: 100%;
    }

    .header-container {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    .header-logo {
        max-width: 120px;
    }

    .main-title {
        font-size: 1.35rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .form-title {
        font-size: 1.05rem;
    }

    .form-subtitle {
        font-size: 0.95rem;
    }

    .instruction-text {
        font-size: 0.9rem;
        padding: 0.625rem;
    }

    .input-lg {
        font-size: 1.1rem !important;
    }

    .input-group-text {
        padding: 0.625rem 0.875rem;
    }

    .form-control {
        padding: 0.625rem 0.875rem;
    }

    .submit-btn {
        font-size: 0.95rem;
        padding: 0.75rem 1.25rem;
        letter-spacing: 0.5px;
    }

    .form-text small {
        font-size: 0.8rem;
    }
}

/* ============================================
   RESPONSIVE - MÓVILES PEQUEÑOS
   ============================================ */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }

    .form-container {
        padding: 1rem;
    }

    .header-logo {
        max-width: 100px;
    }

    .main-title {
        font-size: 1.25rem;
    }

    .input-lg {
        font-size: 1rem !important;
    }
}

/* ============================================
   MEJORAS DE ACCESIBILIDAD
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible para navegación por teclado */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   MODO LANDSCAPE EN MÓVILES
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding: 0.5rem;
    }

    .form-container {
        margin: 0.5rem auto;
        padding: 1rem;
    }

    .header-container {
        flex-direction: row;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .header-logo {
        max-width: 80px;
    }

    .separator {
        margin: 1rem 0;
    }
}

/* ============================================
   AJUSTES PARA iOS
   ============================================ */
@supports (-webkit-touch-callout: none) {
    /* Prevenir zoom en inputs en iOS */
    .form-control,
    .input-lg {
        font-size: 16px !important;
    }
    
    /* Mejorar el área táctil */
    .submit-btn {
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.2);
    }
}

/* ============================================
   ESTADOS DE CARGA (OPCIONAL)
   ============================================ */
.submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

.submit-btn.loading {
    position: relative;
    color: transparent;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spinner 0.6s linear infinite;
}

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