/* ============================================================
   VARIABLES — se sobreescriben en base.html desde reglas.py
   ============================================================ */
:root {
    --color-principal:  #D32F2F;
    --color-hover:      #B71C1C;
    --color-texto:      #424242;
    --color-fondo:      #f4f4f4;
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--color-texto);
    background-color: var(--color-fondo);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Responsive: ajustar padding en móvil */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    background: linear-gradient(135deg, var(--color-principal), var(--color-hover));
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../img/pattern-gpt.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    filter: blur(2px);
    z-index: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.logo-header {
    height: 48px;
    width: auto;
    object-fit: contain;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

/* ============================================================
   MAIN Y FOOTER
   ============================================================ */
main {
    margin: 3rem auto;
    min-height: calc(100vh - 200px);
}

/* Ajuste responsive para móvil */
@media (max-width: 768px) {
    main {
        margin: 1.5rem auto;
    }
}

footer {
    background: linear-gradient(135deg, var(--color-principal), var(--color-hover));
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../img/pattern-gpt.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    filter: blur(2px);
    z-index: 0;
}

footer .container {
    position: relative;
    z-index: 1;
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-container {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 700px;
    margin: 0 auto;
}

/* Responsive: pantallas medianas y grandes */
@media (min-width: 1024px) {
    .form-container {
        max-width: 800px;
        padding: 3rem;
    }
}

/* Responsive: móvil - reducir padding lateral */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem 1rem;
        margin: 0 0.5rem;
    }
}

.form-container h2 {
    color: var(--color-principal);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.descripcion-cargo {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.05), rgba(183, 28, 28, 0.08));
    border-left: 4px solid var(--color-principal);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
    line-height: 1.6;
    color: var(--color-texto);
    font-size: 0.95rem;
}

.descripcion-cargo strong {
    color: var(--color-principal);
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.descripcion-cargo ul {
    margin: 0.5rem 0 0 1.2rem;
    padding: 0;
}

.imagen-portada {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-texto);
    font-weight: 500;
    font-size: 1.02rem;
    line-height: 1.3;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1.05rem;
    min-height: 44px;
    transition: border-color 0.3s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-principal);
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.15);
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    color: #7f8c8d;
    font-size: 0.95rem;
    line-height: 1.35;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    accent-color: var(--color-principal);
}

/* Radio buttons y checkboxes agrupados en fila */
.grupo-checkbox {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}

/* ============================================================
   TELÉFONO (PREFIJO + INPUT)
   ============================================================ */
.grupo-telefono {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
}

.prefijo-telefono {
    padding: 0.65rem 0.75rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
}

.grupo-telefono input[type="tel"] {
    flex: 1 1 12rem;
    min-width: 9.5rem;
}

.grupo-checkbox .label-checkbox,
.label-checkbox {
    display: flex;
    align-items: center;
    font-weight: 400;
    cursor: pointer;
    gap: 0.4rem;
}

.grupo-checkbox input[type="radio"],
.grupo-checkbox input[type="checkbox"] {
    accent-color: var(--color-principal);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Dirección: calle + número en una fila */
.grupo-direccion {
    display: flex;
    gap: 0.6rem;
}

.grupo-direccion input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: #fff;
}

.grupo-direccion input:focus {
    outline: none;
    border-color: var(--color-principal);
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.15);
}

.cargo-box {
    border: 1px solid #e0e0e0;
    padding: 1rem;
    border-radius: 6px;
    background: #fafafa;
    margin-bottom: 1.5rem;
}

/* Rango de años en empresa */
.grupo-rango-anios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.campo-numero {
    width: 90px !important;
    flex-shrink: 0;
    text-align: center;
}

/* Fecha de nacimiento: selectores en grid */
.grupo-fecha {
    display: grid;
    grid-template-columns: 1fr 2fr 1.5fr;
    gap: 10px;
}

.grupo-fecha select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: #fff;
    min-width: 0; /* Importante para evitar overflow en grid */
}

.grupo-fecha select:focus {
    outline: none;
    border-color: var(--color-principal);
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.15);
}

/* Responsive móvil: ajustar selectores de fecha */
@media (max-width: 768px) {
    .grupo-fecha {
        grid-template-columns: 80px 1fr 90px;
        gap: 8px;
    }

    .grupo-fecha select {
        padding: 0.7rem 0.4rem;
        font-size: 0.95rem;
    }

    .grupo-direccion {
        gap: 0.5rem;
    }

    .grupo-direccion input {
        padding: 0.7rem;
        font-size: 0.95rem;
    }

    .campo-numero {
        width: 70px !important;
    }
}

/* Móvil pequeño: ajustes adicionales */
@media (max-width: 480px) {
    .grupo-fecha {
        grid-template-columns: 70px 1fr 85px;
        gap: 6px;
    }

    .grupo-fecha select {
        padding: 0.65rem 0.3rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 600px) {
    .grupo-telefono input[type="tel"] {
        min-width: 0;
        flex: 1 1 8rem;
    }
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn,
.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.1s;
    text-align: center;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary {
    background-color: var(--color-principal, #D32F2F);
    color: white !important;
    width: 100%;
}

.btn-primary:hover,
button.btn-primary:hover {
    background-color: var(--color-hover, #B71C1C);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled,
button.btn-primary:disabled {
    background-color: #bdbdbd;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary:disabled:hover {
    background-color: #bdbdbd;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

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

/* Botones del resumen pre-envío */
.resumen-botones {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.resumen-botones .btn-secondary,
.resumen-botones .btn-primary {
    flex: 1;
}

@media (max-width: 480px) {
    .resumen-botones {
        flex-direction: column;
        gap: 0.6rem;
    }
}

/* ============================================================
   MENSAJES EXITO / ERROR
   ============================================================ */
.mensaje-container {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.icono-exito,
.icono-error {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.exito .icono-exito { color: #27ae60; }
.error .icono-error { color: var(--color-principal); }

.mensaje-container h2 {
    color: var(--color-texto);
    margin-bottom: 1rem;
}

.mensaje-container p {
    margin-bottom: 0.8rem;
}

.info-box {
    background-color: #ecf0f1;
    padding: 1.5rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    text-align: left;
}

.info-box ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.info-box li {
    margin-bottom: 0.5rem;
}

.acciones {
    margin-top: 2rem;
}

.contacto-rrhh {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.contacto-rrhh a {
    color: var(--color-principal);
}

/* ============================================================
   ALERTAS
   ============================================================ */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ============================================================
   MODO PRUEBA — botón flotante y banner
   ============================================================ */

/* Botón flotante esquina inferior derecha */
#btn-modo-prueba-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

#btn-modo-prueba-container form {
    margin: 0;
}

#btn-modo-prueba {
    background: #546e7a;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.3px;
}

#btn-modo-prueba:hover {
    background: #455a64;
    transform: translateY(-1px);
}

#btn-modo-prueba.activo {
    background: #f57c00;
    box-shadow: 0 3px 12px rgba(245, 124, 0, 0.4);
}

#btn-modo-prueba.activo:hover {
    background: #e65100;
}

/* Botón acceso directo a Fase 2 */
#btn-fase2 {
    background: #1976d2;
    color: white;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.3px;
    display: inline-block;
}

#btn-fase2:hover {
    background: #1565c0;
    transform: translateY(-1px);
}

/* Botón descargar XLSX */
#btn-descargar-xlsx {
    background: #388e3c;
    color: white;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.3px;
    display: inline-block;
}

#btn-descargar-xlsx:hover {
    background: #2e7d32;
    transform: translateY(-1px);
}

/* Banner superior cuando está activo */
#banner-modo-prueba {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: #fff3e0;
    border-bottom: 2px solid #f57c00;
    color: #e65100;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Cuando el banner está activo, bajar todo el contenido un poco */
body:has(#banner-modo-prueba) header {
    margin-top: 40px;
}

/* ============================================================
   SECCIÓN TÍTULOS (Fase 2)
   ============================================================ */
.seccion-titulo {
    color: var(--color-principal);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-principal);
    font-size: 1.15rem;
}

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.3rem;
    }

    .mensaje-container {
        padding: 2rem 1.5rem;
    }

    #btn-modo-prueba-container {
        bottom: 16px;
        right: 16px;
    }

    #btn-modo-prueba,
    #btn-fase2,
    #btn-descargar-xlsx {
        padding: 8px 14px;
        font-size: 0.75rem;
    }
}

/* ============================================================
   RESPONSIVE — 480px (móvil pequeño)
   ============================================================ */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.1rem;
    }

    .form-container {
        padding: 1.2rem 0.8rem;
        margin: 0 4px;
    }

    .logo-header {
        height: 36px;
    }

    .seccion-titulo {
        font-size: 1.05rem;
    }

    .btn-primary,
    button.btn-primary {
        padding: 0.7rem 1rem;
        font-size: 0.95rem;
    }
}
