﻿/* ===== RESET Y VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primario: #b65c1d;
    --color-primario-hover: #9e4e19;
    --color-texto: #333;
    --color-texto-secundario: #666;
    --color-fondo: #f5f5f5;
    --color-blanco: #ffffff;
    --color-borde: #ddd;
    --sombra: 0 10px 25px rgba(0, 0, 0, 0.1);
    --borde-redondo: 25px;
}

/* ===== ESTILOS BASE ===== */
body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--color-fondo);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 15px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.contenedor {
    background: var(--color-blanco);
    padding: 30px 25px;
    width: 100%;
    max-width: 500px; /* Más ancho para el registro */
    border-radius: var(--borde-redondo);
    box-shadow: var(--sombra);
    text-align: center;
}

/* ===== TIPOGRAFÍA ===== */
.titulo {
    color: #000;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.subtitulo {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.4;
}

    .subtitulo strong {
        color: var(--color-primario);
        font-weight: 600;
    }

/* ===== FORMULARIO ===== */
form {
    text-align: left;
}

/* Línea divisoria */
.divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

/* Filas de dos columnas */
.fila {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

    .fila input {
        flex: 1;
    }

/* ===== CAMPOS DEL FORMULARIO ===== */
input, select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--color-borde);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    background-color: #fafafa;
    margin-bottom: 15px;
    font-family: Arial, Helvetica, sans-serif;
}

select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23666' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

    input:focus, select:focus {
        border-color: var(--color-primario);
        box-shadow: 0 0 0 3px rgba(182, 92, 29, 0.1);
    }

input::placeholder {
    color: #999;
}

/* Placeholder para select (primer opción) */
select option:first-child {
    color: #999;
}

/* ===== TÉRMINOS Y CONDICIONES ===== */
.terminos {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 15px;
    font-size: 13px;
    color: #666;
}

    .terminos input[type="checkbox"] {
        width: auto;
        margin-bottom: 0;
        cursor: pointer;
        accent-color: var(--color-primario);
        transform: scale(1.1);
    }

    .terminos span {
        line-height: 1.4;
    }

/* ===== BOTÓN ===== */
button[type="submit"] {
    width: 100%;
    padding: 14px;
    background-color: var(--color-primario);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin: 10px 0 20px 0;
}

    button[type="submit"]:hover {
        background-color: var(--color-primario-hover);
    }

    button[type="submit"]:active {
        transform: scale(0.98);
    }

/* ===== ENLACE DE LOGIN ===== */
.link-login {
    text-align: center;
    border-top: 1px solid #eee;
    padding-top: 20px;
    color: #666;
    font-size: 14px;
}

    .link-login a {
        color: var(--color-primario);
        text-decoration: none;
        font-weight: 500;
        margin-left: 5px;
    }

        .link-login a:hover {
            text-decoration: underline;
        }

/* ===== MEDIA QUERIES ===== */

/* Tablets */
@media screen and (max-width: 768px) {
    .contenedor {
        max-width: 90%;
        padding: 25px 20px;
    }

    .fila {
        gap: 10px;
    }

    input, select {
        padding: 11px 13px;
    }
}

/* Móviles */
@media screen and (max-width: 480px) {
    body {
        padding: 10px;
    }

    .contenedor {
        padding: 20px 15px;
    }

    .titulo {
        font-size: 24px;
    }

    .subtitulo {
        font-size: 13px;
        margin-bottom: 15px;
    }

    .fila {
        flex-direction: column;
        gap: 0;
    }

        .fila input:first-child {
            margin-bottom: 15px;
        }

    input, select {
        padding: 10px 12px;
        font-size: 13px;
        margin-bottom: 12px;
    }

    .terminos {
        font-size: 12px;
        margin: 15px 0 10px;
    }

    button[type="submit"] {
        padding: 12px;
        font-size: 15px;
    }

    .link-login {
        padding-top: 15px;
        font-size: 13px;
    }
}

/* Móviles pequeños */
@media screen and (max-width: 320px) {
    .titulo {
        font-size: 22px;
    }

    .subtitulo {
        font-size: 12px;
    }

    input, select {
        padding: 8px 10px;
    }

    .terminos {
        font-size: 11px;
    }
}

/* ===== ANIMACIÓN ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contenedor {
    animation: fadeIn 0.5s ease-out;
}

.politica-password {
    background: #f8f8f8;
    border-left: 4px solid #b65c1d;
    padding: 10px;
    font-size: 13px;
    margin-top: 10px;
}

    .politica-password ul {
        margin-left: 15px;
    }

/* ===== ESTILOS PARA UBICACIÓN ===== */
.subtitulo-ubicacion {
    color: var(--color-primario);
    font-size: 16px;
    margin-bottom: 15px;
    text-align: left;
    font-weight: 500;
    margin-top: 5px;
}

#provincia, #canton, #distrito {
    transition: all 0.3s ease;
}

    #provincia:disabled, #canton:disabled, #distrito:disabled {
        background-color: #f0f0f0;
        opacity: 0.7;
        cursor: not-allowed;
        border-color: #ccc;
    }

    #provincia:not(:disabled):focus,
    #canton:not(:disabled):focus,
    #distrito:not(:disabled):focus {
        border-color: var(--color-primario);
        box-shadow: 0 0 0 3px rgba(182, 92, 29, 0.1);
    }

#provincia, #canton {
    margin-bottom: 15px;
}

/* Estilos para el servicio TSE */
.tse-resultado {
    margin: 10px 0;
    padding: 10px;
    border-radius: 5px;
    display: none;
}

.tse-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 5px;
}

.tse-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
}

.tse-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 10px;
    border-radius: 5px;
}

.tse-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    padding: 10px;
    border-radius: 5px;
}

.tse-loading {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #6B4F3C;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.campo-tsed {
    background-color: #f0f7f0 !important;
    border-left: 3px solid #28a745 !important;
}

.info-tse {
    background-color: #e7f3ff;
    color: #004085;
    border: 1px solid #b8daff;
    padding: 8px;
    margin-top: 5px;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}

.btn-secundario {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    margin-top: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

    .btn-secundario:hover {
        background-color: #5a6268;
    }

    .btn-secundario:disabled {
        background-color: #868e96;
        cursor: not-allowed;
    }

/* Ajustes responsive */
@media screen and (max-width: 480px) {
    .btn-secundario {
        padding: 8px;
        font-size: 13px;
    }

    .tse-resultado {
        font-size: 12px;
    }
}

/* Responsive para móviles */
@media screen and (max-width: 480px) {
    .subtitulo-ubicacion {
        font-size: 15px;
        margin-bottom: 12px;
    }

    #provincia, #canton {
        margin-bottom: 12px;
    }
}

/* Estilo para cuando un select está cargando */
select.loading {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><circle cx="50" cy="50" fill="none" stroke="%23b65c1d" stroke-width="10" r="35" stroke-dasharray="164.93361431346415 56.97787143782138"><animateTransform attributeName="transform" type="rotate" repeatCount="indefinite" dur="1s" values="0 50 50;360 50 50" keyTimes="0;1"></animateTransform></circle></svg>');
    background-size: 20px;
    background-position: right 10px center;
    background-repeat: no-repeat;
}

* ===== CAMPOS CON BOTÓN DE MOSTRAR CONTRASEÑA ===== */
.campo-contenedor {
    position: relative;
    width: 100%;
}

.password-container {
    position: relative;
}

    .password-container input {
        width: 100%;
        padding-right: 45px;
        margin-bottom: 0;
    }

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin: 0;
    font-size: 18px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .toggle-password:hover {
        background-color: rgba(0, 0, 0, 0.05);
        transform: translateY(-50%) scale(1.1);
    }

    .toggle-password:active {
        transform: translateY(-50%) scale(0.95);
    }

.eye-icon {
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.toggle-password:hover .eye-icon {
    opacity: 1;
}

/* Ajuste para móviles */
@media screen and (max-width: 480px) {
    .toggle-password {
        right: 8px;
        width: 30px;
        height: 30px;
    }

    .eye-icon {
        font-size: 16px;
    }

    .password-container input {
        padding-right: 40px;
    }
}

/* Error de contraseñas no coinciden */
.error-mensaje {
    animation: fadeIn 0.3s ease;
}

/* Mejorar el contenedor de la fila para los campos de contraseña */
.fila .campo-contenedor {
    flex: 1;
}

.fila .password-container input {
    margin-bottom: 0;
}