/**
 * PMSC Club Records — Front-end Styles
 * Navy branding: #0C1C8C (primary), #1a2fa8 (hover)
 */

/* Container */
.pmsc-records-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-family: inherit;
}

/* Header */
.pmsc-records-header {
    text-align: center;
    margin-bottom: 24px;
}

.pmsc-records-title {
    color: #0C1C8C;
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 10px;
}

.pmsc-records-desc {
    font-size: 16px;
    color: #666;
    max-width: 700px;
    margin: 0 auto 30px auto;
}

/* Filters */
.pmsc-filters {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.pmsc-filters select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 160px;
    background: #fff;
    cursor: pointer;
}

.pmsc-filters select:focus {
    outline: none;
    border-color: #0C1C8C;
    box-shadow: 0 0 0 2px rgba(12, 28, 140, 0.15);
}

.pmsc-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.pmsc-search-icon {
    position: absolute;
    left: 12px;
    color: #999;
    pointer-events: none;
    display: flex;
}

#pmsc-search {
    padding: 8px 15px 8px 36px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    background: #fff;
}

#pmsc-search:focus {
    outline: none;
    border-color: #0C1C8C;
    box-shadow: 0 0 0 2px rgba(12, 28, 140, 0.15);
}

/* Status bar */
.pmsc-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}

.pmsc-season-range {
    font-style: italic;
}

/* Mobile sort (hidden on desktop) */
.pmsc-mobile-sort {
    display: none;
    align-items: center;
    gap: 6px;
}

.pmsc-sort-dir-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid #0C1C8C;
    border-radius: 6px;
    background: #e8ecf8;
    cursor: pointer;
    color: #0C1C8C;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.pmsc-sort-dir-btn svg {
    width: 20px;
    height: 20px;
    stroke: #0C1C8C;
    stroke-width: 2.5;
}

.pmsc-sort-dir-btn:active {
    background: #c8d0f0;
}

.pmsc-sort-dir-btn.desc svg {
    transform: rotate(180deg);
}

/* Table */
.pmsc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pmsc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.pmsc-table thead th {
    background: #0C1C8C;
    color: #fff;
    padding: 10px 12px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

.pmsc-table thead th.pmsc-sortable {
    cursor: pointer;
    position: relative;
}

.pmsc-table thead th.pmsc-sortable:hover {
    background: #1a2fa8;
}

.pmsc-table thead th.pmsc-sort-active {
    background: #1a2fa8;
}

/* Sort icons (SVG-based three-state) */
.pmsc-sort-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.pmsc-sortable:hover .pmsc-sort-icon {
    opacity: 0.8;
}

.pmsc-sort-icon-active {
    opacity: 1;
}

.pmsc-sort-icon .pmsc-icon-asc,
.pmsc-sort-icon .pmsc-icon-desc {
    display: none;
}

.pmsc-sort-icon .pmsc-icon-unsorted {
    display: inline;
}

.pmsc-sort-icon-active[data-dir="asc"] .pmsc-icon-unsorted { display: none; }
.pmsc-sort-icon-active[data-dir="asc"] .pmsc-icon-asc { display: inline; }
.pmsc-sort-icon-active[data-dir="asc"] .pmsc-icon-desc { display: none; }

.pmsc-sort-icon-active[data-dir="desc"] .pmsc-icon-unsorted { display: none; }
.pmsc-sort-icon-active[data-dir="desc"] .pmsc-icon-asc { display: none; }
.pmsc-sort-icon-active[data-dir="desc"] .pmsc-icon-desc { display: inline; }

.pmsc-sort-arrow {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.4;
}

.pmsc-sort-active .pmsc-sort-arrow {
    opacity: 1;
}

.pmsc-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.pmsc-table tbody tr:nth-child(odd) td {
    background: #f8f9fb;
}

.pmsc-table tbody tr:nth-child(even) td {
    background: #fff;
}

.pmsc-table tbody tr:hover td {
    background: #e8ecf8;
}

.pmsc-time {
    font-weight: 700;
}

/* No results */
.pmsc-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 15px;
}

/* Swimmer link style */
.pmsc-swimmer-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted #ccc;
    cursor: pointer;
}

.pmsc-swimmer-link:hover {
    color: #0C1C8C;
    border-bottom-color: #0C1C8C;
}

/* Pagination */
.pmsc-pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 4px;
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

.pmsc-per-page {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pmsc-per-page select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
}

.pmsc-per-page select:focus {
    outline: none;
    border-color: #0C1C8C;
    box-shadow: 0 0 0 2px rgba(12, 28, 140, 0.15);
}

.pmsc-page-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pmsc-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.pmsc-page-btn:hover:not(:disabled) {
    background: #e8ecf8;
    border-color: #0C1C8C;
}

.pmsc-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pmsc-page-btn.pmsc-page-active {
    background: #0C1C8C;
    color: #fff;
    border-color: #0C1C8C;
    font-weight: 600;
}

.pmsc-page-info {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

/* MOBILE RESPONSIVE (card layout) */
@media screen and (max-width: 768px) {
    /*
     * Mobile padding is now handled at the theme level (child theme style.css
     * v1.2.2): .inside-article gets 10px horizontal padding on mobile.
     * No negative-margin hack needed — the wrap flows naturally.
     */
    .pmsc-records-wrap { margin-left: 0; margin-right: 0; padding: 0; }
    .pmsc-records-title { font-size: 28px; }
    .pmsc-records-desc { font-size: 14px; }
    .pmsc-filters { flex-direction: column; align-items: stretch; gap: 8px; }
    .pmsc-filters select, .pmsc-search-wrap, #pmsc-search { min-width: 0 !important; width: 100%; }
    .pmsc-search-wrap { width: 100%; }
    #pmsc-search { width: 100% !important; }
    .pmsc-mobile-sort { display: flex !important; justify-content: center; }
    .pmsc-mobile-sort select { min-width: auto; flex: 1; }
    .pmsc-status-bar { padding: 6px 0; }

    /* ── Table card layout ── */
    .pmsc-table-wrap { overflow-x: visible; }

    /*
     * NUCLEAR BORDER RESET — kill every border the theme sets on table elements.
     * GeneratePress main.min.css applies: table,td,th { border: 1px solid rgba(0,0,0,.1) }
     * The child theme adds: table td { border-bottom: 1px solid ... }
     * Previous approach overrode each side individually; Safari/iOS can still bleed
     * theme borders on semantic <table> elements even with display:block.
     * Fix: reset ALL borders on ALL table descendants with the shorthand, then
     * selectively restore only the borders we want on higher-specificity selectors.
     */
    .pmsc-table-wrap,
    .pmsc-table,
    .pmsc-table thead,
    .pmsc-table tbody,
    .pmsc-table tr,
    .pmsc-table th,
    .pmsc-table td,
    .pmsc-table td::before { border: none !important; border-spacing: 0 !important; }

    /* Table container: block layout, collapse mode (safer than separate on Safari) */
    .pmsc-table { min-width: 0 !important; width: 100% !important; display: block !important; border-collapse: collapse !important; border-spacing: 0 !important; }
    .pmsc-table thead { display: none; }
    .pmsc-table tbody { display: block; width: 100%; }

    /* Each row becomes a card: restore outer border, rounded corners, spaced apart */
    .pmsc-table tbody tr { display: block; margin-bottom: 12px; border: 1px solid #ddd !important; border-radius: 6px; padding: 0; background: #fff; box-shadow: none; overflow: hidden; }
    .pmsc-table tbody tr:last-child { margin-bottom: 0; }
    .pmsc-table tbody tr:hover td { background: transparent; }
    .pmsc-table tbody tr:nth-child(odd) td,
    .pmsc-table tbody tr:nth-child(even) td { background: transparent; }

    /* Cells: flex row with label::before on left, value on right; bottom separator only */
    .pmsc-table tbody td { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 10px; border: none !important; border-bottom: 1px solid #f0f0f0 !important; font-size: 13px; white-space: normal; word-break: break-word; }
    .pmsc-table tbody td:last-child { border-bottom: none !important; }
    .pmsc-table tbody td::before { content: attr(data-label); font-weight: 600; color: #0C1C8C; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; flex: 0 0 35%; padding-right: 8px; }
    .pmsc-table tbody td.pmsc-time { font-weight: 700; font-size: 15px; }

    .pmsc-pagination-wrap { flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; }
}
