/* ============================================
   FORMULARIOS LOGIN & REGISTRO — CORDAMI
   Premium Glassmorphism + Clean UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Base ── */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    background-image: url('/img/truck-working-field-sunny-day.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* ── Contenedor del formulario ── */
.form-container {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 35px 30px 25px;
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(31, 38, 135, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 100%;
    max-width: 460px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */
.form-container .form-logo {
    display: block;
    margin: 0 auto 28px auto;
    width: 85%;
    max-width: 340px;
    height: auto;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

/* ── Título del formulario ── */
.form-container h1 {
    color: #1a5e2a;
    font-size: clamp(20px, 3.5vw, 26px);
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: -0.3px;
}

/* ── Form layout ── */
.form-container form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Inputs ── */
.form-container input[type="text"],
.form-container input[type="tel"],
.form-container input[type="email"],
.form-container input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    margin: 0 0 20px 0;
    background: rgba(255, 255, 255, 0.6);
    border: 1.5px solid #d0d5dd;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1a1a1a;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.form-container input::placeholder {
    color: #7a8599;
    font-weight: 500;
}

.form-container input:focus {
    outline: none;
    border-color: #28a745;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

/* ── Password Wrapper ── */
.password-wrapper {
    position: relative;
    width: 100%;
    margin: 0 0 20px 0;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    width: 100%;
    margin-bottom: 0;
    padding-right: 50px;
}

/* ── Toggle Password Button ── */
.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 6px;
    width: auto !important;
    min-width: unset;
    color: #7a8599;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
}

.toggle-password:hover {
    background: rgba(40, 167, 69, 0.08) !important;
    color: #28a745;
}

/* ── Submit Button ── */
.form-container button[type="submit"] {
    width: 100%;
    padding: 14px;
    margin: 8px 0 0 0;
    background: linear-gradient(135deg, #28a745, #1e8e3e);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.25);
}

.form-container button[type="submit"]:hover {
    background: linear-gradient(135deg, #1e8e3e, #176d30);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(40, 167, 69, 0.35);
}

.form-container button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

/* ── Register Link ── */
.register-link {
    text-align: center;
    margin-top: 18px;
}

.register-link p {
    font-size: 0.88rem;
    color: #555;
}

.register-link a {
    color: #1e8e3e;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.register-link a:hover {
    color: #28a745;
    text-decoration: underline;
}

/* ── Policies ── */
.policies {
    font-size: 0.75rem;
    text-align: center;
    margin-top: 16px;
    color: #888;
    line-height: 1.5;
}

.policies a {
    color: #1e8e3e;
    text-decoration: none;
    font-weight: 500;
}

.policies a:hover {
    text-decoration: underline;
}

/* ── Error Messages ── */
.error {
    display: block;
    margin: -12px 0 12px 0;
    color: #dc3545;
    font-size: 0.78rem;
    font-weight: 500;
}

input {
    transition: border 0.25s ease, box-shadow 0.25s ease;
}

.input-error {
    border: 1.5px solid #dc3545 !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* ── Password Strength ── */
#password-strength {
    font-size: 0.82rem;
    margin: -12px 0 12px 0;
    padding: 0 4px;
    font-weight: 600;
}

/* ── Password Guide ── */
.password-guide {
    width: 100%;
    margin: -8px 0 16px 0;
    padding: 14px 18px;
    background: rgba(248, 249, 250, 0.9);
    border-radius: 10px;
    border-left: 4px solid #28a745;
    font-size: 0.82rem;
    box-sizing: border-box;
}

.password-guide .guide-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.88rem;
}

.password-guide ul {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
}

.password-guide li {
    padding: 3px 0;
    color: #c0392b;
    transition: color 0.2s;
    font-weight: 500;
}

.password-guide li.valid {
    color: #27ae60;
}

.password-guide .guide-allowed {
    color: #666;
    font-size: 0.78rem;
    margin-top: 6px;
    border-top: 1px solid #e0e0e0;
    padding-top: 6px;
}

/* ── Persona Selector (Natural/Jurídico) ── */
.persona-selector {
    margin-bottom: 22px;
}

.persona-selector-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: 0.2px;
}

.persona-radio-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.persona-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.persona-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px solid #d0d5dd;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.persona-chip svg {
    transition: transform 0.3s ease;
}

.persona-chip:hover {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.06);
    color: #1e8e3e;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.12);
}

.persona-radio input[type="radio"]:checked + .persona-chip {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.12), rgba(30, 142, 62, 0.08));
    border-color: #28a745;
    color: #1a5e2a;
    box-shadow: 0 2px 12px rgba(40, 167, 69, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.persona-radio input[type="radio"]:checked + .persona-chip svg {
    transform: scale(1.15);
}

/* ── Select Dropdown ── */
.select-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.form-container select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.6);
    border: 1.5px solid #d0d5dd;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1a1a1a;
    transition: all 0.25s ease;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8599' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-container select:focus {
    outline: none;
    border-color: #28a745;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

.form-container select option[value=""][disabled] {
    color: #7a8599;
}

/* ── Sector Selector (Privada/Pública) ── */
.sector-selector {
    margin-bottom: 20px;
    text-align: center;
}

.sector-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.sector-radio-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.sector-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sector-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    background: rgba(255, 255, 255, 0.45);
    border: 1.5px solid #d0d5dd;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.sector-chip:hover {
    border-color: #28a745;
    color: #1e8e3e;
}

.sector-radio input[type="radio"]:checked + .sector-chip {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(30, 142, 62, 0.06));
    border-color: #28a745;
    color: #1a5e2a;
    font-weight: 600;
    box-shadow: 0 1px 6px rgba(40, 167, 69, 0.15);
}

/* ── Date Input ── */
.date-wrapper {
    margin-bottom: 20px;
}

.date-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.form-container input[type="date"] {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.6);
    border: 1.5px solid #d0d5dd;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1a1a1a;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.form-container input[type="date"]:focus {
    outline: none;
    border-color: #28a745;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

/* ── Form Section Transitions ── */
#form-natural,
#form-juridico {
    animation: fadeSlideIn 0.35s ease-out;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .login-body {
        padding: 15px;
        align-items: flex-start;
        padding-top: 30px;
    }
    
    .form-container {
        padding: 24px 20px 18px;
        border-radius: 14px;
    }
    
    .form-container .form-logo {
        width: 80%;
        max-width: 280px;
        margin-bottom: 22px;
    }
    
    .form-container input[type="text"],
    .form-container input[type="tel"],
    .form-container input[type="email"],
    .form-container input[type="password"] {
        padding: 12px 14px;
        font-size: 0.9rem;
        margin-bottom: 16px;
    }
    
    .password-wrapper {
        margin-bottom: 16px;
    }
    
    .form-container button[type="submit"] {
        padding: 12px;
        font-size: 0.95rem;
    }

    .persona-chip {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .form-container select,
    .form-container input[type="date"] {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .sector-chip {
        padding: 7px 14px;
        font-size: 0.82rem;
    }
}

@media (max-width: 360px) {
    .login-body {
        padding: 10px;
        padding-top: 20px;
    }
    
    .form-container {
        padding: 20px 16px 15px;
        border-radius: 12px;
    }
    
    .form-container .form-logo {
        width: 78%;
        max-width: 240px;
        margin-bottom: 18px;
    }
    
    .form-container input[type="text"],
    .form-container input[type="tel"],
    .form-container input[type="email"],
    .form-container input[type="password"] {
        padding: 10px 12px;
        font-size: 0.85rem;
        margin-bottom: 14px;
        border-radius: 8px;
    }
    
    .password-wrapper {
        margin-bottom: 14px;
    }
    
    .toggle-password {
        right: 6px;
    }
    
    .toggle-password svg {
        width: 18px;
        height: 18px;
    }
    
    .form-container button[type="submit"] {
        padding: 11px;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .password-guide {
        padding: 10px 14px;
        font-size: 0.76rem;
    }
    
    .register-link p,
    .policies p {
        font-size: 0.72rem;
    }
    
    .error {
        font-size: 0.72rem;
    }

    .persona-selector-label {
        font-size: 0.8rem;
    }

    .persona-chip {
        padding: 7px 14px;
        font-size: 0.8rem;
        gap: 5px;
    }

    .persona-chip svg {
        width: 14px;
        height: 14px;
    }

    .form-container select,
    .form-container input[type="date"] {
        padding: 10px 12px;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    .sector-chip {
        padding: 6px 12px;
        font-size: 0.78rem;
    }

    .sector-label,
    .date-label {
        font-size: 0.76rem;
    }

    .captcha-preview canvas {
        max-width: 200px;
    }
}

/* ── CAPTCHA ── */
.captcha-wrapper {
    width: 100%;
    margin-bottom: 20px;
}

.captcha-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.captcha-preview canvas {
    border-radius: 8px;
    background: #f3f4f6;
    border: 1px solid #d0d5dd;
    flex-grow: 1;
    max-width: 250px;
}

.reload-btn {
    background: rgba(255,255,255,0.7) !important;
    border: 1px solid #d0d5dd !important;
    border-radius: 8px;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.reload-btn:hover {
    background: #fff !important;
    color: #1a5e2a;
    border-color: #28a745 !important;
    transform: rotate(15deg);
}

.captcha-wrapper input {
    margin-bottom: 0 !important;
}
