/* Reset y base estructural */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    background-color: #f9fafb;
    color: #1f2937;
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Encabezado fijo */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: #111827;
    color: #f9fafb;
    padding: 1rem 2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    text-align: center;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Contenido principal */
main {
    margin-top: 96px;
    padding: 2rem 1rem;
}

/* Contenedor central */
.container {
    max-width: 960px;
    margin: auto;
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 0 0 1px #e5e7eb;
    overflow-x: auto;
}

/* Títulos */
h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
    animation: fadeIn 0.3s ease-in-out;
}

.alert.success {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #10b981;
}

.alert.error {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #ef4444;
}

/* Formularios */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus,
select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
    outline: none;
}

/* Botón principal */
button {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

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

/* Tabla de inscritos */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 0 0 1px #e5e7eb;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 600px;
    background-color: #ffffff;
    color: #1f2937;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.95rem;
}

th {
    background-color: #f3f4f6;
    font-weight: 700;
    color: #111827;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr:hover {
    background-color: #f9fafb;
}

/* Botón secundario */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #059669;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #047857;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    width: 320px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.modal-content input {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.modal-content button {
    margin: 0.25rem;
}

#mensaje-clave {
    margin-top: 0.5rem;
    font-weight: bold;
}

/* Resumen */
.resumen-linea {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    font-weight: bold;
    padding: 10px;
    border-top: 1px solid #d1d5db;
}

.resumen-linea span {
    flex: 1 1 auto;
    min-width: 150px;
}

/* Paginación */
.pagination button.active {
    background-color: #2563eb;
    color: white;
    border: none;
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        background-color: #f3f4f6;
        width: 100%;
    }

    header {
        padding: 0.75rem 1rem;
        position: relative;
    }

    header h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    main {
        margin-top: 0;
        padding: 1rem;
        width: 100%;
    }

    .container {
        width: 100%;
        margin: 0;
        padding: 1.25rem;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        box-sizing: border-box;
    }

    h2 {
        font-size: 1.35rem;
        margin-bottom: 1.25rem;
        text-align: center;
        padding-bottom: 0.75rem;
    }

    /* Formularios en móvil */
    form {
        gap: 1.25rem;
    }

    input, select {
        padding: 0.9rem 1rem;
        font-size: 1rem;
    }

    button {
        padding: 0.9rem;
        font-size: 1.05rem;
    }

    /* Tabla adaptada para móvil */
    .table-container {
        width: 100%;
        margin: 1.25rem 0;
        border-radius: 10px;
        overflow: hidden;
    }

    table {
        display: block;
        width: 100%;
        min-width: unset;
    }

    thead {
        display: none;
    }

    tbody, tr {
        display: block;
        width: 100%;
    }

    tr {
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 1rem;
        background: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }

    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.85rem 0;
        border-bottom: 1px solid #f3f4f6;
        width: 100%;
        box-sizing: border-box;
    }

    td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #4b5563;
        padding-right: 1rem;
        flex: 1;
    }

    td > *:not(:first-child) {
        flex: 2;
        text-align: right;
    }

    /* Botones de navegación */
    .botones-navegacion {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        margin-top: 2rem;
        width: 100%;
    }

    .botones-navegacion .btn {
        width: 100%;
        padding: 1rem;
        text-align: center;
        font-size: 1.05rem;
        border-radius: 10px;
        font-weight: 600;
    }

    .modal {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        inset: 0;
        padding: 1rem;
        background-color: rgba(0, 0, 0, 0.5); /* opcional para fondo */
        z-index: 9999;
    }
    
    .modal-content {
        width: 100%;
        max-width: 400px;
        padding: 1.75rem;
        border-radius: 14px;
        background-color: #fff; /* asegurar contraste */
    }
    

    /* Resumen en columna */
    .resumen-linea {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.25rem;
        margin: 1.5rem 0;
        background-color: #f9fafb;
        border-radius: 10px;
        border-top: 1px solid #e5e7eb;
    }

    .resumen-linea span {
        display: flex;
        justify-content: space-between;
        width: 100%;
        padding: 0.25rem 0;
    }

    /* Alertas mejoradas */
    .alert {
        padding: 1.25rem;
        border-radius: 10px;
        margin-bottom: 1.5rem;
    }

    /* Paginación para móviles */
    .pagination {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        margin-top: 1.5rem;
    }

    .pagination button {
        min-width: 44px;
        height: 44px;
    }
}