@import url('/style.css');

/* ========== Layout general ========== */
.main-section {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.title {
    margin: 0 auto 4px;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
}

/* ========== Selector “pill” ========== */
.toolbar {
    padding: 4px 0 6px 0;
}

.select-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}

#sel-maestra {
    border: 0;
    outline: 0;
    background: #fff;
    color: #111;
    font-weight: 600;
    padding: 4px 6px;
    border-radius: 12px;
    appearance: auto;
}

/* ========== Tarjeta de tabla ========== */
.table-card {
    position: relative;
    background: #fff;
    border: 1px solid #cfe6fb;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    padding: 8px 8px 18px;
    display: flex;
    /* ← nuevo */
    flex-direction: column;
    /* ← nuevo */
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

.data-table thead th {
    text-align: left;
    background: #f0f7ff;
    color: #1f4e79;
    border-bottom: 1px solid #dbeafe;
    padding: 12px 10px;
}

.data-table tbody td {
    border-bottom: 1px solid #eef2f7;
    padding: 14px 10px;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f7fbff;
}

.th-accion {
    width: 60px;
    text-align: center;
}

/* ========== Acciones ========== */
.actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-icon {
    all: unset;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-weight: 700;
    line-height: 1;
}

.btn-del {
    color: #d93025;
}

.btn-del:hover {
    background: rgba(217, 48, 37, .08);
}

.btn-upd {
    color: #22a055;
}

.btn-upd:hover {
    background: rgba(34, 160, 85, .08);
}

/* Botón flotante (crear) */
.fab-add {
    position: static;
    /* ← deja de ser absoluto */
    align-self: flex-start;
    /* se alinea al inicio de la tarjeta */
    margin: 12px 0 0 10px;
    /* separación respecto a la tabla */
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: #0a66ff;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    border: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(10, 102, 255, .35);
}

.fab-add:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ========== Filas de edición/creación ========== */
.row-edit input[type="text"],
.row-create input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    height: 36px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #9ec9f0;
    background: #eef7ff;
    color: #222;
}

.row-edit .edit-actions,
.row-create .create-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

.btn {
    background: #2d2d2d;
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
}

.btn.btn-light {
    background: #e7f2ff;
    color: #135a92;
    border: 1px solid #9ec9f0;
}

/* ========== Modal confirmación ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: #fff;
    border: 4px solid #27a9f4;
    border-radius: 28px;
    width: min(560px, calc(100% - 40px));
    padding: 28px 24px 22px;
    text-align: center;
    box-shadow: 0 6px 32px rgba(0, 0, 0, .15);
    color: #333;
}

.modal-text {
    font-size: 18px;
    margin: 0 0 8px;
}

.modal-note {
    color: #333;
    margin: 0 0 18px;
}

.modal-actions {
    display: flex;
    gap: 24px;
    justify-content: center;
}

/* Accesibilidad */
.sr-only {
    width: 1px;
    height: 1px;
    padding: 10px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    font-size: large;
}

/* Responsive */
@media (max-width: 980px) {
    .th-accion {
        width: 96px;
    }
}

/* ========== Drag & Drop (reordenamiento manual) ========== */
.data-table tbody tr[draggable="true"] {
    cursor: grab;
}

.data-table tbody tr.dragging {
    opacity: 0.5;
    background-color: #e0e0e0;
}

.data-table tbody tr.drop-target {
    outline: 2px dashed #0a66ff;
}

/* ——— Leyenda en filas ——— */
.td-text .desc-line {
    font-weight: 600;
}

.td-text .leyenda-line {
    margin-top: .25rem;
    font-size: .9rem;
    color: #4b5563;
}

.leyenda-label {
    opacity: .8;
    margin-right: .25rem;
}

.row-2inputs {
    display: grid;
    gap: .5rem;
}

.inp-edit.inp-leyenda,
.inp-create.inp-leyenda {
    font-style: normal;
}