/* ── Excel Table Pro — Public Styles ─────────────────────────────────────── */

:root {
    --etp-header-bg:    #1e3a5f;
    --etp-header-color: #ffffff;
    --etp-header-fs:    14px;
    --etp-body-fs:      13px;
    --etp-stripe-bg:    #f0f4f8;
    --etp-hover-bg:     #dbeafe;
    --etp-radius:       8px;
    --etp-border-color: #e2e8f0;
    --etp-cell-px:      14px;
    --etp-cell-py:      10px;
}

/* Wrapper */
.etp-wrapper {
    --etp-header-bg:    inherit;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 1.5em 0;
    width: 100%;
}

/* Controls bar */
.etp-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}
.etp-search {
    padding: 7px 14px;
    font-size: 13px;
    border: 1.5px solid var(--etp-border-color);
    border-radius: 20px;
    outline: none;
    width: min(280px, 100%);
    transition: border-color .2s, box-shadow .2s;
}
.etp-search:focus {
    border-color: var(--etp-header-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--etp-header-bg) 20%, transparent);
}

/* Scroll container */
.etp-scroll-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--etp-radius);
}
.etp-wrapper.etp-shadow .etp-scroll-container {
    box-shadow: 0 4px 20px rgba(0,0,0,.10);
}

/* Table */
.etp-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: var(--etp-body-fs);
    table-layout: auto;
}

/* Caption */
.etp-table caption {
    caption-side: top;
    text-align: left;
    padding: 0 0 8px;
    font-size: .95em;
    font-weight: 600;
    color: #374151;
}

/* Header */
.etp-th {
    background: var(--etp-header-bg);
    color: var(--etp-header-color);
    font-size: var(--etp-header-fs);
    font-weight: 600;
    padding: var(--etp-cell-py) var(--etp-cell-px);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
    user-select: none;
}
.etp-th:first-child { border-radius: var(--etp-radius) 0 0 0; }
.etp-th:last-child  { border-radius: 0 var(--etp-radius) 0 0; }

/* Sort icon */
.etp-sortable-col { cursor: pointer; }
.etp-sortable-col:hover { filter: brightness(1.12); }
.etp-sort-icon { display: inline-block; margin-left: 6px; opacity: .5; font-size: 11px; }
.etp-sort-icon::after { content: '⇅'; }
.etp-sortable-col.etp-asc  .etp-sort-icon::after { content: '↑'; opacity: 1; }
.etp-sortable-col.etp-desc .etp-sort-icon::after { content: '↓'; opacity: 1; }

/* Body cells */
.etp-td {
    padding: var(--etp-cell-py) var(--etp-cell-px);
    vertical-align: middle;
    word-break: break-word;
    max-width: 360px;
}

/* Horizontal lines */
.etp-hlines .etp-td,
.etp-hlines .etp-th {
    border-bottom: 1px solid var(--etp-border-color);
}

/* Vertical lines */
.etp-vlines .etp-td,
.etp-vlines .etp-th {
    border-right: 1px solid var(--etp-border-color);
}
.etp-vlines .etp-td:first-child,
.etp-vlines .etp-th:first-child {
    border-left: 1px solid var(--etp-border-color);
}

/* Striped rows */
.etp-stripe .etp-row:nth-child(even) .etp-td {
    background: var(--etp-stripe-bg);
}

/* Hover */
.etp-hover .etp-row:hover .etp-td {
    background: var(--etp-hover-bg);
    transition: background .15s;
}

/* Hidden by search / pagination */
.etp-row.etp-hidden { display: none; }

/* Pagination */
.etp-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.etp-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1.5px solid var(--etp-border-color);
    border-radius: 50%;
    background: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    line-height: 1;
    padding: 0;
}
.etp-page-btn:hover:not(:disabled) {
    background: var(--etp-header-bg);
    color: var(--etp-header-color);
    border-color: var(--etp-header-bg);
}
.etp-page-btn:disabled { opacity: .35; cursor: default; }
.etp-page-info { font-size: 13px; color: #6b7280; }

/* Error message */
.etp-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 14px;
}

/* ── Responsive tweaks ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .etp-th, .etp-td {
        padding: 8px 10px;
        font-size: 12px;
    }
    .etp-search { width: 100%; }
    .etp-controls { justify-content: stretch; }
}
