* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f9f0f7;
    color: #3a2040;
    padding: 2rem 1.5rem 4rem;
}

header {
    max-width: 1100px;
    margin: 0 auto 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #fde8f3;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #9b6bc5;
}

header h1 span {
    color: #e991bb;
}

header p {
    font-size: 13px;
    color: #9a7aaa;
    text-align: right;
    line-height: 1.5;
}

.controls {
    max-width: 1100px;
    margin: 0 auto 1rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.controls input {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 13px;
    padding: 7px 14px;
    border: 1px solid #e8cfe8;
    border-radius: 20px;
    background: #ffffff;
    color: #3a2040;
    flex: 1;
    min-width: 180px;
    outline: none;
}

.controls input:focus {
    border-color: #9b6bc5;
}

.filter-btn {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid #e8cfe8;
    border-radius: 20px;
    background: #ffffff;
    color: #9a7aaa;
    cursor: pointer;
}

.filter-btn:hover {
    background: #ede0ff;
    color: #9b6bc5;
}

.filter-btn.active {
    background: #9b6bc5;
    border-color: #9b6bc5;
    color: #fff;
}

.count-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: #fde8f3;
    color: #e991bb;
}

/* ══════════════════════════════════════════
   CONTENEDOR DE LA TABLA (Con Scroll)
   ══════════════════════════════════════════ */
.table-wrap {
    max-width: 1100px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e8cfe8;
    border-radius: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Deslizamiento suave en pantallas táctiles */
}

/* ══════════════════════════════════════════
   TABLA PRINCIPAL
   ══════════════════════════════════════════ */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 850px; /* Fuerza el scroll horizontal en pantallas pequeñas */
}

colgroup col:nth-child(1) {
    width: 40px;
}

colgroup col:nth-child(2) {
    width: 155px;
}

colgroup col:nth-child(3) {
    width: 95px;
}

colgroup col:nth-child(4) {
    width: 205px;
}

colgroup col:nth-child(5) {
    width: 195px;
}

colgroup col:nth-child(6) {
    width: 185px;
}

thead tr {
    background: #fde8f3;
    border-bottom: 1.5px solid #e8cfe8;
}

th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9b6bc5;
    padding: 11px 12px;
    text-align: left;
}

th:first-child {
    text-align: center;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f5eaf5;
    vertical-align: middle;
    font-size: 13px;
    line-height: 1.5;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: #fdf5fb;
}

td:first-child {
    text-align: center;
    color: #9a7aaa;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.desc {
    font-weight: 600;
}

.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
}

.b-dom {
    background: #ede0ff;
    color: #9b6bc5;
}

.b-evento {
    background: #fde8f3;
    color: #e991bb;
}

.b-efecto {
    background: #ffeaf4;
    color: #c0507a;
}

.b-ajax {
    background: #ece0ff;
    color: #7040b0;
}

.b-util {
    background: #fce8ff;
    color: #a040b0;
}

code {
    font-family: 'Courier New', monospace;
    font-size: 11.5px;
    background: #fdf0f8;
    border: 1px solid #f0d8ee;
    border-radius: 6px;
    padding: 6px 10px;
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    color: #6030a0;
    line-height: 1.7;
}

.instruccion {
    font-size: 12px;
    color: #9a7aaa;
    line-height: 1.6;
}

.demo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 4px 0;
}

.d-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.d-box {
    width: 44px;
    height: 26px;
    border-radius: 6px;
    background: #e991bb;
    transition: all .4s;
}

.d-btn {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1.5px solid #e8cfe8;
    background: #ffffff;
    color: #9b6bc5;
    cursor: pointer;
    transition: all .2s;
}

.d-btn:hover {
    background: #ede0ff;
    border-color: #9b6bc5;
}

.d-btn.danger:hover {
    background: #fde8f3;
    border-color: #e991bb;
    color: #e991bb;
}

.d-text {
    font-size: 13px;
    font-weight: 600;
    color: #3a2040;
    transition: color .3s;
}

.d-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: #ede0ff;
    color: #9b6bc5;
    opacity: 0;
    transition: opacity .3s;
}

.d-input {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 12px;
    padding: 5px 10px;
    border: 1.5px solid #e8cfe8;
    border-radius: 8px;
    width: 110px;
    outline: none;
    color: #3a2040;
}

.d-input:focus {
    border-color: #9b6bc5;
}

.d-list {
    list-style: none;
    font-size: 12px;
}

.d-list li {
    padding: 2px 0;
    color: #9a7aaa;
}

.d-count {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #9b6bc5;
}

#no-results {
    display: none;
    text-align: center;
    padding: 2.5rem;
    color: #9a7aaa;
    font-size: 14px;
}

/* ══════════════════════════════════════════
   MEDIA QUERIES (Para Celulares)
   ══════════════════════════════════════════ */
@media screen and (max-width: 600px) {
    body {
        padding: 1.5rem 1rem 3rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    header p {
        text-align: left;
    }

    .controls {
        justify-content: center;
    }

    .controls input {
        width: 100%;
        min-width: 100%;
        margin-bottom: 8px;
    }

    .filter-btn {
        flex: 1 1 calc(33.33% - 8px); 
        text-align: center;
        padding: 6px 8px;
    }

    .count-badge {
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
}