/* GOOSPLACE global UI enhancements: back-to-top + searchable/sortable tables */
.gp-back-to-top {
    position: fixed;
    right: clamp(16px, 2.4vw, 30px);
    bottom: clamp(16px, 2.4vw, 30px);
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid rgba(217, 183, 111, .45);
    border-radius: 999px;
    background: rgba(7, 16, 29, .94);
    color: #f7e7bd;
    box-shadow: 0 14px 38px rgba(0, 0, 0, .28);
    font: 700 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: .02em;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease, background .2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.gp-back-to-top::before { content: "↑"; font-size: 18px; line-height: 1; }
.gp-back-to-top:hover,
.gp-back-to-top:focus-visible { background: #111f33; outline: none; }
.gp-back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

.gp-table-shell {
    width: min(100%, 1320px);
    margin: 18px auto 26px;
}
.gp-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 10px;
}
.gp-table-search {
    position: relative;
    flex: 1 1 260px;
    max-width: 430px;
}
.gp-table-search input {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 14px 10px 40px;
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: 12px;
    background: rgba(255, 255, 255, .96);
    color: #101828;
    font: 500 14px/1.3 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-shadow: 0 7px 24px rgba(15, 23, 42, .08);
}
.gp-table-search::before {
    content: "⌕";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-52%);
    color: #667085;
    font-size: 21px;
    pointer-events: none;
}
.gp-table-search input:focus {
    border-color: rgba(194, 154, 72, .8);
    outline: 3px solid rgba(194, 154, 72, .14);
}
.gp-table-count {
    color: #667085;
    font: 600 12px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    white-space: nowrap;
}
.gp-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
}
.gp-enhanced-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
.gp-enhanced-table th {
    position: relative;
    user-select: none;
}
.gp-enhanced-table th.gp-sortable {
    cursor: pointer;
    padding-right: 30px !important;
}
.gp-enhanced-table th.gp-sortable::after {
    content: "↕";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(100, 116, 139, .75);
    font-size: 12px;
}
.gp-enhanced-table th.gp-sortable[aria-sort="ascending"]::after { content: "↑"; color: #b68a37; }
.gp-enhanced-table th.gp-sortable[aria-sort="descending"]::after { content: "↓"; color: #b68a37; }
.gp-table-empty {
    padding: 18px;
    text-align: center;
    color: #667085;
    font-weight: 600;
}

/* Bring legacy DataTables controls into the same visual system. */
.dataTables_wrapper {
    width: min(96%, 1320px);
    margin: 18px auto 28px;
    color: inherit;
}
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length { margin-bottom: 12px; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    min-height: 40px;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 10px;
    background: #fff;
    color: #101828;
    padding: 7px 10px;
    box-sizing: border-box;
}
.dataTables_wrapper .dataTables_filter input { min-width: min(280px, 55vw); }
.dataTables_wrapper table.dataTable { width: 100% !important; }
.dataTables_wrapper table.dataTable thead th { cursor: pointer; }

@media (max-width: 700px) {
    .gp-back-to-top { padding: 0; width: 46px; justify-content: center; }
    .gp-back-to-top span { display: none; }
    .gp-table-toolbar { align-items: stretch; }
    .gp-table-search { max-width: none; flex-basis: 100%; }
    .gp-table-count { padding: 0 2px; }
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length { float: none !important; text-align: left !important; }
    .dataTables_wrapper .dataTables_filter input { width: 100%; min-width: 0; margin: 6px 0 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
    .gp-back-to-top { transition: none; scroll-behavior: auto; }
}

/* R10.1: every genuine data table remains fully reachable on narrow screens. */
.gp-table-scroll,
.dataTables_scrollBody,
.dataTables_wrapper {
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(18, 95, 85, .45) rgba(18, 95, 85, .08);
}
.gp-table-scroll {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    border: 1px solid rgba(20, 74, 67, .10);
    background: rgba(255,255,255,.78);
}
.gp-table-scroll:focus-visible {
    outline: 3px solid rgba(18, 95, 85, .18);
    outline-offset: 2px;
}
.gp-table-scroll-wide::after {
    content: "Deslice horizontalmente para ver más columnas →";
    display: none;
    position: sticky;
    left: 0;
    width: max-content;
    margin: 8px 12px 10px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(244, 239, 226, .94);
    color: #49645f;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .01em;
}
.gp-family-history { width: min(100%, 1480px); margin: 22px auto 34px; }
.gp-family-table .gp-family-note { min-width: 220px; white-space: normal !important; }
.gp-family-table .gp-file-cell { text-align: center; min-width: 82px; }
.gp-family-table .gp-file-cell img { object-fit: cover; border-radius: 6px; }
.gp-table-empty-row td { text-align: center !important; padding: 28px 16px !important; color: #667b76 !important; }

/* DataTables owns sorting/searching for its tables; force the table viewport to scroll rather than clip. */
.dataTables_wrapper .dataTables_scroll,
.dataTables_wrapper .dataTables_scrollHead,
.dataTables_wrapper .dataTables_scrollBody { max-width: 100% !important; }
.dataTables_wrapper .dataTables_scrollBody { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

@media (max-width: 820px) {
    .gp-table-scroll-wide::after { display: block; }
    .gp-table-shell { width: 100%; }
}


/* R12.2-RC7 — global horizontal table navigation.
   Every genuine data table gets a bottom scroll viewport plus a synchronized
   top rail, so wide columns remain reachable even on long tables. */
.gp-table-shell,
.gp-family-history,
.gp-family-list,
.dataTables_wrapper {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
}
.gp-table-scroll {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}
.gp-table-scroll > table {
    max-width: none !important;
}
.gp-table-scroll-top {
    display: none;
    width: 100%;
    height: 18px;
    margin: 2px 0 7px;
    overflow-x: scroll;
    overflow-y: hidden;
    scrollbar-gutter: stable;
    border-radius: 999px;
    background: rgba(15,90,93,.045);
    scrollbar-width: auto;
    scrollbar-color: #0f5a5d #e7eeec;
}
.gp-table-scroll-top.is-active { display: block; }
.gp-table-scroll-top-spacer { height: 1px; }
.gp-table-scroll-top::-webkit-scrollbar,
.gp-table-scroll::-webkit-scrollbar,
.dataTables_scrollBody::-webkit-scrollbar,
.gp-global-datatable-direct-scroll::-webkit-scrollbar {
    height: 13px;
}
.gp-table-scroll-top::-webkit-scrollbar-track,
.gp-table-scroll::-webkit-scrollbar-track,
.dataTables_scrollBody::-webkit-scrollbar-track,
.gp-global-datatable-direct-scroll::-webkit-scrollbar-track {
    background: #e7eeec;
    border-radius: 999px;
}
.gp-table-scroll-top::-webkit-scrollbar-thumb,
.gp-table-scroll::-webkit-scrollbar-thumb,
.dataTables_scrollBody::-webkit-scrollbar-thumb,
.gp-global-datatable-direct-scroll::-webkit-scrollbar-thumb {
    background: #0f5a5d;
    border: 3px solid #e7eeec;
    border-radius: 999px;
}
.gp-family-table {
    min-width: 1480px !important;
}
.dataTables_wrapper .dataTables_scrollBody,
.gp-global-datatable-direct-scroll {
    overflow-x: auto !important;
    max-width: 100% !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}
@media (max-width: 820px) {
    .gp-table-scroll-top { margin-bottom: 9px; }
}
