﻿/* Reset y fuente */
* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

body {
    background: #f4f6f9;
    margin: 0;
    padding: 40px 0;
}

body.dark {
    background: radial-gradient(circle at 20% 50%, #0a0f2a, #030617);
    color: #ffffff;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    color: #1e2a3a;
}

body.dark .theme-toggle {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    color: #ffffff;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 123, 255, 0.5);
}

.theme-toggle i {
    font-size: 16px;
    transition: transform 0.3s ease;
    color: currentColor;
}

.theme-toggle:hover i {
    transform: rotate(15deg);
}

.register-container {
    width: 100%;
    max-width: 1000px;
    margin: auto;
    background: #fff;
    padding: 30px 50px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

body.dark .register-container {
    background: rgba(10, 20, 40, 0.75);
    border: 1px solid rgba(0, 123, 255, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

h2 {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 3px solid #0d6efd;
    padding-bottom: 10px;
}

/* Formulario en filas */
.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

body.dark label {
    color: #a0c0e0;
}

input, select {
    width: 100%;
    padding: 14px;
    border-radius: 6px;
    border: 1px solid #cfd6df;
    font-size: 15px;
    transition: all 0.2s ease;
}

body.dark input,
body.dark select {
    background: rgba(20, 30, 55, 0.6);
    border-color: rgba(0, 123, 255, 0.3);
    color: #ffffff;
}

body.dark input::placeholder {
    color: rgba(160, 192, 224, 0.5);
}

body.dark select option {
    background: rgba(20, 30, 55, 0.98);
    color: #ffffff;
}

input:focus, select:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13,110,253,0.15);
}

body.dark input:focus,
body.dark select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.password-input-container {
    position: relative;
    width: 100%;
}

.password-input-container input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease;
}

.toggle-password:hover,
.toggle-password:focus {
    color: #0d6efd;
    outline: none;
}

.password-requirements,
.password-match-indicator {
    font-size: 12px;
    margin-top: 8px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
    min-height: 20px;
}

.help-text {
    font-size: 12px;
    color: #444;
    margin-top: 5px;
}

body.dark .help-text,
body.dark .password-requirements,
body.dark .password-match-indicator {
    color: #a0c0e0;
}

.full-width {
    width: 100%;
}

hr {
    margin: 25px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.btn-primary {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #e5e7eb;
    color: #374151;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .theme-toggle i {
        font-size: 18px;
    }
}

/* Modal de registro */
.modal-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 350px;
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

body.dark .modal-content {
    background: linear-gradient(135deg, rgba(15, 25, 45, 0.95), rgba(5, 10, 25, 0.98));
    border: 1px solid rgba(0, 123, 255, 0.3);
    color: #ffffff;
}

body.dark .modal-content p {
    color: #c0d0e8;
}

.modal-content.success {
    border-top: 5px solid #22c55e;
}

.modal-content.error {
    border-top: 5px solid #ef4444;
}

.modal-content h3 {
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-content button {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: white;
    cursor: pointer;
}

.modal-content button:hover {
    background: #1e40af;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Fila tipo cuenta + código de acceso con grid */
.form-row-access-code {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dos columnas iguales */
    gap: 20px;
    align-items: start; /* Alinea labels e inputs arriba */
    margin-bottom: 18px;
}

.form-row-access-code .form-group {
    display: flex;
    flex-direction: column;
}

#codigo_acceso_container {
    display: none; /* Oculto por defecto */
}

/* Verificación de código de acceso */
.access-code-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
    background: #ffffff;
}

.access-code-group:focus-within {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.access-code-prefix {
    background: #e5e7eb;
    color: #374151;
    font-weight: 700;
    font-size: 14px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    border: none;
    border-right: 1px solid #d1d5db;
    white-space: nowrap;
    flex-shrink: 0;
}

.access-code-group input {
    border: none;
    border-radius: 0;
    font-weight: 600;
    color: #1f3b5b;
    flex: 1;
    min-width: 0;
    outline: none;
    box-shadow: none;
    background: #ffffff;
}

.access-code-group input:focus {
    box-shadow: none;
    border-color: transparent;
}

.access-code-group input:disabled {
    background-color: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}

.btn-verify-code {
    background: #2563eb;
    color: #fff;
    border: none;
    border-left: 1px solid #d1d5db;
    padding: 0 16px;
    border-radius: 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.btn-verify-code:hover:not(:disabled) {
    background: #1d4ed8;
}

.btn-verify-code:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

body.dark .access-code-group {
    background: rgba(20, 30, 55, 0.6);
    border-color: rgba(0, 123, 255, 0.3);
}

body.dark .access-code-group:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

body.dark .access-code-prefix {
    background: rgba(0, 123, 255, 0.35);
    border-right-color: rgba(0, 123, 255, 0.3);
    color: #ffffff;
}

body.dark .access-code-group input {
    background: transparent;
    color: #ffffff;
}

body.dark .access-code-group input:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(160, 192, 224, 0.6);
}

body.dark .btn-verify-code {
    background: #2563eb;
    color: #ffffff;
}

body.dark .btn-verify-code:hover:not(:disabled) {
    background: #1d4ed8;
}

body.dark .btn-verify-code:disabled {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
}

.access-code-feedback {
    display: none;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: #ef4444;
}

.access-code-feedback.success {
    background: #22c55e;
}

@media (max-width: 600px) {
    .access-code-group {
        flex-wrap: wrap;
    }

    .access-code-group input {
        width: 100%;
        order: 3;
        border-left: none;
        border-right: none;
        border-top: 1px solid #d1d5db;
        border-bottom: 1px solid #d1d5db;
    }

    .access-code-prefix {
        order: 1;
        border-right: 1px solid #d1d5db;
    }

    .btn-verify-code {
        order: 2;
        flex: 1;
        border-left: none;
        padding: 10px;
    }
}

/* Apellidos y nombres: los completa la consulta del DNI (RENIEC) */
input[readonly] {
    background: #eef1f5;
    color: #4b5563;
    cursor: not-allowed;
}

body.dark input[readonly] {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
}

.dni-mensaje {
    display: block;
    min-height: 16px;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.dni-mensaje.error {
    color: #dc2626;
}
