/* ==========================================================================
   SYWAT Archery - Data Tables & Responsive Scrolling
   Path: assets/css/sywat-tables.css
   Version: 7.5.2
   ========================================================================== */

/* Header Toolbar Alignments (Lock buttons to bottom baseline, labels flush left) */
.sywat-header-inline-controls,
.sywat-table-header-controls,
.sywat-table-header-filters,
.sywat-table-header-actions {
    display: flex;
    align-items: flex-end !important;
    gap: 6px;
    flex-wrap: wrap;
}

.sywat-filter-inline-form,
.sywat-table-header-actions form {
    margin: 0;
    display: flex;
    align-items: flex-end;
}

.sywat-header-inline-controls .sywat-field-group,
.sywat-table-header-filters .sywat-field-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    margin: 0;
}

.sywat-header-inline-controls .sywat-field-group label,
.sywat-table-header-filters .sywat-field-group label {
    display: block !important;
    text-align: left !important;
    width: 100% !important;
    margin-bottom: 4px !important;
    font-weight: 700 !important;
    color: var(--sywat-navy-soft) !important;
    line-height: 1 !important;
}

/* Base Responsive Tables */
.sywat-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sywat-table-responsive::-webkit-scrollbar { height: 6px; }
.sywat-table-responsive::-webkit-scrollbar-track { background: var(--sywat-surface-muted); border-radius: 4px; }
.sywat-table-responsive::-webkit-scrollbar-thumb { background: var(--sywat-border); border-radius: 4px; }
.sywat-table-responsive::-webkit-scrollbar-thumb:hover { background: var(--sywat-border-strong); }

/* Base table rules are scoped (specificity 0,2,1) so theme content-table rules
   such as Divi's `.entry-content tr td` cannot override plugin cell padding. */
:is(.sywat-wrap, .sywat-app, .sywat-scope, .sywat-modal-backdrop) table.sywat-table,
.sywat-table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

:is(.sywat-wrap, .sywat-app, .sywat-scope, .sywat-modal-backdrop) .sywat-table th {
    background-color: #f6f7f7;
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    color: #1d2327;
    border-bottom: 1px solid #c3c4c7;
    white-space: nowrap;
}

:is(.sywat-wrap, .sywat-app, .sywat-scope, .sywat-modal-backdrop) .sywat-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f1;
    color: #2c3338;
    vertical-align: middle;
}

.sywat-table .sywat-btn {
    height: 28px;
    padding: 2px 8px;
    font-size: 12px;
}

/* Compact Order Column Move Up / Move Down Controls */
.sywat-order-controls {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.sywat-order-num {
    display: inline-block;
    min-width: 22px;
    font-weight: 700;
    color: var(--sywat-navy);
    text-align: center;
}

.sywat-order-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    width: auto;
}

.sywat-table .sywat-btn.sywat-btn-order {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
    line-height: 1;
}

.sywat-table .sywat-btn.sywat-btn-order:disabled,
.sywat-table .sywat-btn.sywat-btn-order:disabled:hover {
    background-color: var(--sywat-surface-muted);
    border-color: var(--sywat-border);
    opacity: 0.45;
    cursor: not-allowed;
}

/* Row Hover & Member Table Link Styling */
.sywat-member-row,
.sywat-board-row {
    transition: background-color 0.15s ease;
}

.sywat-member-row:hover,
.sywat-board-row:hover {
    background-color: var(--sywat-surface-alt);
}

.sywat-table-link {
    color: #2271b1;
    text-decoration: none;
}

.sywat-table-link:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Inline Table Action Forms (Centered Alignment) */
.sywat-table-action-form {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto !important;
    text-align: center !important;
}

/* Action Cell Alignment & Vertical Stacking Support */
.sywat-table-actions {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    margin: 0 auto !important;
}

.sywat-table-actions-vertical,
.sywat-manage-row td:last-child > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    width: 100% !important;
    max-width: 140px;
    margin: 0 auto !important;
}

.sywat-table-actions .sywat-btn,
.sywat-table-actions form {
    margin: 0 !important;
    flex: 0 0 auto !important;
}

.sywat-table-actions-vertical .sywat-btn,
.sywat-table-actions-vertical form,
.sywat-manage-row td:last-child > div .sywat-btn,
.sywat-manage-row td:last-child > div form {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 140px;
    box-sizing: border-box !important;
}

/* Static Action Badges inside Vertical Action Stacks */
.sywat-table-actions-vertical .sywat-badge {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 140px;
    height: 28px !important;
    box-sizing: border-box !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

/* ==========================================================================
   Isolated Modal Roster Buttons (Strict Block Width Lock)
   ========================================================================== */
.sywat-modal-roster-actions {
    display: block !important;
    width: 85px !important;
    min-width: 85px !important;
    max-width: 85px !important;
    margin: 0 auto !important;
}

.sywat-modal-roster-actions form {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.sywat-modal-roster-actions a.sywat-btn {
    margin: 0 0 4px 0 !important;
}

.sywat-modal-roster-actions a.sywat-btn,
.sywat-modal-roster-actions form button.sywat-btn {
    width: 100% !important;
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    line-height: 24px !important;
    padding: 0 !important;
    font-size: 11px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
}

/* Default Last Column Behavior */
:is(.sywat-wrap, .sywat-app, .sywat-scope, .sywat-modal-backdrop) .sywat-table th:last-child,
:is(.sywat-wrap, .sywat-app, .sywat-scope, .sywat-modal-backdrop) .sywat-table td:last-child { 
    text-align: right; 
}

/* Explicit Alignment Utilities (Overrides Defaults) */
.sywat-table th.text-center, .sywat-table td.text-center, .sywat-table th.sywat-col-center, .sywat-table td.sywat-col-center, .sywat-col-center { text-align: center !important; }
.sywat-table th.text-right, .sywat-table td.text-right, .sywat-table th.sywat-col-right, .sywat-table td.sywat-col-right, .sywat-col-right { text-align: right !important; }
.sywat-table th.text-left, .sywat-table td.text-left, .sywat-table th.sywat-col-left, .sywat-table td.sywat-col-left, .sywat-col-left { text-align: left !important; }

/* Percentage-Based Column Width Utilities */
.sywat-col-w-10 { width: 10%; }
.sywat-col-w-12 { width: 12%; }
.sywat-col-w-14 { width: 14%; }
.sywat-col-w-22 { width: 22%; }
.sywat-col-w-24 { width: 24%; }
.sywat-col-w-32 { width: 32%; }

/* Table Column Width Utilities */
.sywat-col-date       { width: 22%; }
.sywat-col-tourn      { width: 32%; }
.sywat-col-shooters   { width: 15%; text-align: center; }
.sywat-col-action     { width: 16%; text-align: center; }

.sywat-col-rank        { width: 50px; text-align: center; font-weight: bold; }
.sywat-col-score       { width: 110px; text-align: center; }
.sywat-col-total       { width: 130px; text-align: right; }
.sywat-col-tourn-score { width: 140px; text-align: right; }

/* Line Slot Usage Table Specific Columns */
.sywat-col-line-name   { width: 40%; }
.sywat-col-cap-20yd    { width: 20%; text-align: center !important; }
.sywat-col-cap-cub     { width: 20%; text-align: center !important; }
.sywat-col-line-action { width: 20%; text-align: center !important; }
.sywat-col-line-action form,
.sywat-col-line-action .sywat-table-action-form {
    display: inline-flex !important;
    justify-content: center !important;
    margin: 0 auto !important;
}

/* Archer Roster Table Specific Columns & Lock */
.sywat-roster-table {
    table-layout: fixed !important;
    min-width: 0 !important;
    width: 100% !important;
}
.sywat-roster-table th, .sywat-roster-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}
.sywat-col-roster-name   { width: 28%; }
.sywat-col-roster-type   { width: 18%; text-align: center; }
.sywat-col-roster-line   { width: 22%; }
.sywat-col-roster-dist   { width: 14%; text-align: center; }
.sywat-col-roster-action { width: 18%; text-align: center !important; }

/* ==========================================================================
   Phone & Group Registration Intake Row Alignment
   ========================================================================== */
.sywat-archer-header-row,
.sywat-archer-input-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    margin-bottom: 8px;
    box-sizing: border-box !important;
}

.sywat-archer-header-row {
    font-weight: 700;
    font-size: 12px;
    color: var(--sywat-navy-soft);
    padding: 6px 0;
    border-bottom: 1px solid var(--sywat-border);
    margin-bottom: 10px;
}

.sywat-col-archer-name   { flex: 3 !important; min-width: 0; }
.sywat-col-archer-dist   { flex: 1.5 !important; min-width: 0; }
.sywat-col-archer-div    { flex: 2.5 !important; min-width: 0; }
.sywat-col-archer-line   { flex: 2 !important; min-width: 0; }
.sywat-col-archer-action { flex: 0 0 36px !important; text-align: center !important; display: flex; justify-content: center; }

.sywat-archer-input-row .sywat-field-group {
    margin-bottom: 0 !important;
    width: 100% !important;
}

.sywat-archer-input-row input,
.sywat-archer-input-row select {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Line Slot Capacity Stack & Compact Waitlist Pill */
.sywat-lines-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 20px;
}

.sywat-line-slot-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--sywat-surface-alt);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--sywat-border-light);
    font-size: 12px;
}

.sywat-line-slot-title { font-weight: 700; color: var(--sywat-navy-soft); white-space: nowrap; }

.sywat-line-slot-caps { 
    display: flex; 
    gap: 8px; 
    color: var(--sywat-text-muted); 
    align-items: center; 
    font-size: 11px; 
    white-space: nowrap; 
}

.sywat-line-slot-caps .sywat-waitlist-pill {
    font-size: 11px !important;
    line-height: 1.2 !important;
    padding: 1px 6px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
}

.sywat-lines-total {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--sywat-border);
    font-size: 12px;
    color: var(--sywat-navy-soft);
    text-align: center;
}

.sywat-tracker-container {
    margin-bottom: 24px;
}

/* Check-In Family Prompt Banner */
.sywat-family-banner {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.sywat-family-banner-title {
    font-size: 15px;
    font-weight: bold;
}

.sywat-family-banner-subtext {
    font-size: 13px;
}

.sywat-family-banner-actions {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    margin-top: 4px !important;
}

/* Status Indicator Utilities & Badges */
.sywat-text-open   { color: #008a20; font-weight: 600; }
.sywat-text-closed { color: #d63638; font-weight: 600; }

.sywat-badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sywat-badge-group-vertical {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.sywat-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 3px 10px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.sywat-badge-open {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.sywat-badge-closed {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.sywat-badge-registered {
    background-color: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

.sywat-badge-checkedin {
    background-color: #ccfbf1;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

.sywat-badge-pro {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-weight: 800;
}

.sywat-badge-full {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.sywat-badge-prereg {
    background-color: var(--sywat-primary-tint);
    color: var(--sywat-primary-dark);
    border: 1px solid #bae6fd;
}

.sywat-badge-walkin {
    background-color: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.sywat-badge-muted {
    background-color: var(--sywat-surface-muted);
    color: #646970;
    border: 1px solid var(--sywat-border);
}

.sywat-badge-unassigned {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    font-weight: 700;
}

.sywat-badge-family-cap {
    font-size: 10px;
    font-weight: 700;
    color: var(--sywat-primary);
    background: var(--sywat-primary-tint);
    padding: 2px 4px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 2px;
}

.sywat-chip-family {
    font-size: 11px;
    color: #155724;
    background: #d4edda;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

/* Tournament Row Metadata Typography & Chips */
.sywat-tourn-title  { font-size: 15px; color: var(--sywat-navy); display: block; }
.sywat-tourn-season { font-size: 12px; color: var(--sywat-heading); font-weight: 700; margin-top: 3px; }
.sywat-tourn-shop   { font-size: 12px; color: var(--sywat-primary); font-weight: 600; margin-top: 2px; }
.sywat-tourn-dates  { font-size: 11px; color: var(--sywat-text-subtle); margin-top: 2px; }
.sywat-hub-chip-na  { color: var(--sywat-border-strong); font-size: 11px; font-weight: 600; }

/* Cell Content Formatting */
.sywat-archer-cell-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sywat-archer-name {
    font-weight: bold;
    color: var(--sywat-navy);
}

.sywat-owe-badge-wrap {
    margin-top: 4px;
}

.sywat-col-paid {
    font-weight: bold;
    color: #0073aa;
}

.sywat-empty-text {
    color: var(--sywat-text-subtle);
    font-style: italic;
}

.sywat-score-null { color: var(--sywat-border-strong); }
.sywat-score-cell { font-size: 13px; font-weight: 700; color: var(--sywat-navy); }

@media (max-width: 600px) {
    .sywat-archer-cell-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .sywat-archer-cell-content .sywat-btn-sm {
        margin-left: 0 !important;
    }
}

/* ==========================================================================
   BRUTE-FORCE MODAL TABLE LOCK (Zero Horizontal Scrolling)
   ========================================================================== */

.sywat-modal-body .sywat-table-responsive { overflow-x: hidden !important; width: 100% !important; max-width: 100% !important; }

.sywat-modal-repeater-table { table-layout: fixed !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; border-collapse: collapse !important; min-width: 0 !important; }
.sywat-modal-repeater-table th, .sywat-modal-repeater-table td { padding: 4px !important; vertical-align: middle !important; box-sizing: border-box !important; overflow: hidden !important; }

.sywat-modal-repeater-table select, .sywat-modal-repeater-table input[type="text"], .sywat-modal-repeater-table input[type="number"] {
    height: 30px !important; min-height: 30px !important; font-size: 12px !important; padding: 2px 4px !important; margin: 0 !important;
    box-sizing: border-box !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important;
}

.sywat-modal-repeater-table input[type="number"].sywat-col-num-input { text-align: center !important; }

.sywat-modal-repeater-table .sywat-btn-sm {
    width: 100% !important; padding: 4px 0 !important; font-size: 11px !important; height: 30px !important;
    line-height: 1 !important; white-space: nowrap !important; display: flex !important; align-items: center !important;
    justify-content: center !important; box-sizing: border-box !important; margin: 0 !important;
}

/* Strict Mathematical Column Constraints (Exactly 100%) */
.sywat-modal-repeater-table th:nth-child(1), .sywat-modal-repeater-table td:nth-child(1) { width: 30% !important; } /* Day */
.sywat-modal-repeater-table th:nth-child(2), .sywat-modal-repeater-table td:nth-child(2) { width: 26% !important; } /* Time */
.sywat-modal-repeater-table th:nth-child(3), .sywat-modal-repeater-table td:nth-child(3) { width: 14% !important; text-align: center !important; } /* 20yd */
.sywat-modal-repeater-table th:nth-child(4), .sywat-modal-repeater-table td:nth-child(4) { width: 14% !important; text-align: center !important; } /* Cub */
.sywat-modal-repeater-table th:nth-child(5), .sywat-modal-repeater-table td:nth-child(5) { width: 16% !important; text-align: center !important; } /* Action */

@media (max-width: 768px) {
    /* Keep table totally locked even on mobile */
    .sywat-modal-body .sywat-table-responsive { overflow-x: hidden !important; }
    .sywat-modal-repeater-table { table-layout: fixed !important; }
}

/* Print Engine & Invoice Layout */
.invoice-box { font-family: Arial, sans-serif; color: #000; width: 100%; max-width: 800px; margin: 0 auto; padding: 10px; box-sizing: border-box; }
.invoice-title { text-align: center; font-size: 20px; font-weight: bold; margin-bottom: 2px; }
.invoice-subtitle { text-align: center; font-size: 11px; margin-bottom: 15px; font-style: italic; }
.invoice-header-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; }
.invoice-header-table td { padding: 4px 6px; font-size: 12px; }
.invoice-header-label { font-weight: bold; width: 28%; white-space: nowrap; }
.invoice-header-val { background-color: #DAE6F5; border: 1px solid #7092BE; font-weight: bold; padding: 4px 8px; }
.invoice-fee-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; }
.invoice-fee-table th { background-color: var(--sywat-surface-muted); border: 1px solid #000; padding: 6px; font-size: 12px; text-align: left; }
.invoice-fee-table td { border: 1px solid #000; padding: 6px; font-size: 12px; }
.blue-shade { background-color: #DAE6F5; font-weight: bold; text-align: right; }
.invoice-footer { text-align: center; font-size: 11px; margin-top: 15px; line-height: 1.5; }
.invoice-footer-bold { font-weight: bold; color: var(--sywat-heading); }

@media print {
    .sywat-table-responsive { overflow: visible !important; }
    .sywat-table { width: 100% !important; min-width: 0 !important; border-collapse: collapse !important; page-break-inside: auto !important; }
    .sywat-table tr { page-break-inside: avoid !important; break-inside: avoid !important; page-break-after: auto !important; }
    .sywat-table thead { display: table-header-group !important; }
    .invoice-header-val, .invoice-fee-table th, .blue-shade { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
