/* ==========================================================================
   1. VARIABLES Y CONFIGURACIÓN GENERAL
   ========================================================================== */
:root {
    --color-principal: #2c3e50;
    --color-secundario: #34495e;
    --color-fondo: #f5f7fa;
    --color-tarjeta: #ffffff;
    --color-texto: #333333;
    --color-exito: #2ecc71;
    --color-exito-hover: #27ae60;
    --color-peligro: #e74c3c;
    --color-peligro-hover: #c0392b;
    --color-borde: #e2e8f0;
    --fuente: 'Quicksand', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--fuente);
    background-color: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   2. HEADER Y NAVEGACIÓN
   ========================================================================== */
.header {
    background-color: var(--color-principal);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo img {
    display: block;
    object-fit: contain;
}

.menu h3 {
    font-weight: 600;
    letter-spacing: 1px;
}

/* ==========================================================================
   3. ESTRUCTURA PRINCIPAL (MAIN)
   ========================================================================== */
main {
    flex: 1;
    display: max-content;
    max-width: 1200px;
    width: 95%;
    margin: 2rem auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    main {
        grid-template-columns: 1.6fr 1fr; /* Tabla a la izquierda (más ancha), Formulario a la derecha */
        align-items: start;
    }
}

/* Contenedores comunes para Secciones */
.tabla-section, .form-section {
    background-color: var(--color-tarjeta);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   4. TABLA RESPONSIVA
   ========================================================================== */
.tablita {
    overflow-x: auto; /* Permite scroll horizontal en pantallas pequeñas */
    width: 100%;
}

.tabla {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.tabla thead tr {
    background-color: var(--color-secundario);
    color: #ffffff;
}

.tabla th, .tabla td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--color-borde);
}

.tabla tbody tr:last-child td {
    border-bottom: 2px solid var(--color-secundario);
}

.tabla tbody tr:nth-of-type(even) {
    background-color: #f8fafc;
}

.tabla tbody tr:hover {
    background-color: #f1f5f9;
}

/* ==========================================================================
   5. FORMULARIO Y CAMPOS
   ========================================================================== */
.caja {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
}

@media (min-width: 600px) and (max-width: 991px) {
    .caja {
        grid-template-columns: 1fr 1fr; /* Dos columnas en tablets */
    }
}

.campo {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.campo label {
    font-weight: 600;
    color: var(--color-secundario);
    font-size: 0.9rem;
}

.campo input {
    padding: 10px 14px;
    border: 1px solid var(--color-borde);
    border-radius: 6px;
    font-family: var(--fuente);
    font-size: 0.95rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    width: 100%;
}

.campo input:focus {
    outline: none;
    border-color: var(--color-principal);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.15);
}

/* ==========================================================================
   6. BOTONES (SUBMIT, EDITAR, BORRAR)
   ========================================================================== */
.boton-container {
    margin-top: 1.5rem;
}

/* Botón Guardar del Formulario */
button.submit {
    width: 100%;
    padding: 12px;
    background-color: var(--color-principal);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--fuente);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

button.submit:hover {
    background-color: var(--color-secundario);
}

/* Botones de acción dentro de la Tabla (Editar y Borrar) */
.tabla input.submit {
    padding: 6px 12px;
    margin: 2px;
    border: none;
    border-radius: 4px;
    font-family: var(--fuente);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s, transform 0.1s;
}

/* Estilo específico para Editar */
.tabla input.submit:not(.delete-btn) {
    background-color: var(--color-exito);
}

.tabla input.submit:not(.delete-btn):hover {
    background-color: var(--color-exito-hover);
}

/* Estilo específico para Borrar */
.tabla .delete-btn {
    background-color: var(--color-peligro);
}

.tabla .delete-btn:hover {
    background-color: var(--color-peligro-hover);
}

.tabla input.submit:active {
    transform: scale(0.96);
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
.footer {
    background-color: var(--color-principal);
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: auto;
}

.social {
    display: inline-block;
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: background-color 0.3s, transform 0.3s;
}

.social:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
}

/*