/* PRMS style: premium clean table borders + low-opacity cell backgrounds
   - Ready to replace: wp-content/plugins/prms-plugin/assets/css/prms-style.css
   - Adds solid outer border, inner cell borders, subtle low-opacity backgrounds,
     rounded header, improved spacing for premium look.
*/

/* Variables */
:root{
  --prms-accent: #667eea;
  --prms-red: #dc2626;
  --prms-border-color: rgba(14, 22, 41, 0.08);
  --prms-cell-bg: rgba(249, 250, 251, 0.6);
  --prms-header-bg: rgba(249, 250, 251, 0.9);
  --prms-gap: 10px;
  --prms-radius: 10px;
  --prms-table-radius: 12px;
}

/* Container hint for desktop-emulation */
.prms-force-desktop { touch-action: auto; -webkit-text-size-adjust:100%; text-size-adjust:100%; }

/* Top row */
.prms-top-row {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:var(--prms-gap);
  margin-bottom:12px;
  flex-wrap:wrap;
}

/* Tabs row */
.prms-tabs-row {
  display:flex;
  gap:8px;
  align-items:center;
  white-space:nowrap;
  flex: 1 1 auto;
  overflow: hidden;
}

/* Tab visuals */
.prms-tab { display:inline-flex; flex-direction:column; min-width:150px; padding:8px 12px; border-radius:8px; background: linear-gradient(180deg,#fff,#fbfbff); border:1px solid rgba(14,22,41,0.06); cursor:pointer; }
.prms-tab.active { background:#eef2ff; border-color:#cbd7ff; }

/* Recent landings */
.prms-recent-landings { min-width:240px; max-width:380px; width:320px; padding:8px; border-radius:8px; background:#fff; box-shadow:0 6px 18px rgba(11,20,40,0.04); }
.prms-recent-header { font-weight:700; margin-bottom:8px; }
.prms-recent-cards { display:flex; flex-direction:column; gap:8px; }

/* Recent card */
.prms-recent-card { display:flex; gap:8px; align-items:center; padding:8px; border-radius:8px; background:linear-gradient(180deg,#fff,#fbfdff); border:1px solid rgba(14,22,41,0.03); }
.prms-recent-card.highlight { box-shadow: 0 8px 20px rgba(102,126,234,0.06); border-color: rgba(102,126,234,0.12); }
.prms-avatar { width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; color:#fff; background:linear-gradient(135deg,var(--prms-accent),#764ba2); }

/* Winner alert (red) */
.prms-winner-alert { display:flex; align-items:center; gap:10px; background:var(--prms-red); color:#fff; padding:8px 10px; border-radius:8px; box-shadow:0 8px 20px rgba(220,38,38,0.12); }
.prms-winner-avatar, .prms-winner-avatar-initials { width:44px; height:44px; border-radius:50%; }

/* Winners container */
.prms-winner-summary { display:flex; gap:10px; align-items:center; margin-top:8px; }

/* Table wrapper for premium look */
.prms-tournament-results {
  width:100%;
  box-sizing:border-box;
  margin-top:10px;
  background: #ffffff;
  border-radius: var(--prms-table-radius);
  border: 1px solid var(--prms-border-color);
  box-shadow: 0 8px 24px rgba(11,20,40,0.04);
  overflow: hidden; /* clip rounded corners */
}

/* Premium table */
.prms-modern-table {
  width:1200px; /* desktop layout width (browser will scale on mobile due to viewport) */
  table-layout: fixed;
  border-collapse: collapse;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  border: 1px solid var(--prms-border-color);
  border-radius: 12px;
  overflow: hidden;
}

/* Header styling with rounded top corners */
.prms-modern-table thead th {
  padding:12px 14px;
  font-weight:700;
  background: var(--prms-header-bg);
  border-bottom: 1px solid var(--prms-border-color);
  text-align:left;
  color: #0f172a;
  position: relative;
  font-size: 13px;
}

/* Add right borders to header cells (except last) */
.prms-modern-table thead th:not(:last-child) {
  border-right: 1px solid var(--prms-border-color);
}

/* Body cells: low-opacity backgrounds and inner cell borders for clean grid */
.prms-modern-table tbody td {
  padding:8px 10px;
  vertical-align:middle;
  background: var(--prms-cell-bg);
  border-bottom: 1px solid rgba(14,22,41,0.04);
  border-right: 1px solid rgba(14,22,41,0.03);
  transition: background-color 0.2s ease;
  line-height: 1.3;
  font-size: 13px;
}

/* Remove right border on last cell of row */
.prms-modern-table tbody td:last-child { border-right: none; }

/* Slight zebra using very low opacity */
.prms-modern-table tbody tr:nth-child(even) td { background-color: rgba(243, 244, 246, 0.28); }

/* Hover highlight: subtle darker tint to indicate hover (not green) */
.prms-modern-table tbody tr:hover td { background-color: rgba(102, 126, 234, 0.06); }

/* Remove bottom border from last row */
.prms-modern-table tbody tr:last-child td { border-bottom: none; }

/* Competitor cell styling: wider name column and avatar spacing */
.prms-competitor-cell { display:flex; align-items:center; gap:10px; }
.prms-competitor-avatar { width:40px; height:40px; border-radius:50%; object-fit:cover; margin-right:8px; }
.prms-competitor-name { font-weight:700; color:#0b1220; }

/* Column width hints */
.prms-modern-table thead th.col-competitor,
.prms-modern-table tbody td.col-competitor { width: 25%; }
.prms-modern-table thead th.col-city,
.prms-modern-table tbody td.col-city { width: 12%; }
.prms-modern-table thead th.col-total,
.prms-modern-table tbody td.col-total { width: 12%; text-align:center; }
.prms-modern-table thead th.col-pigeon,
.prms-modern-table tbody td.col-pigeon { width: auto; text-align:center; }

/* Top-3 row highlights */
.prms-top-0 { background: linear-gradient(90deg, rgba(255,243,205,0.35), rgba(255,243,205,0.15)) !important; border-left: 3px solid #fbbf24; }
.prms-top-1 { background: linear-gradient(90deg, rgba(241,245,249,0.25), rgba(241,245,249,0.1)) !important; border-left: 3px solid #94a3b8; }
.prms-top-2 { background: linear-gradient(90deg, rgba(250,244,236,0.22), rgba(250,244,236,0.08)) !important; border-left: 3px solid #d97706; }

/* Winner cell highlights */
.prms-cell-first-winner { background: linear-gradient(90deg, rgba(255,248,225,0.6), rgba(255,248,225,0.2)) !important; border-left:4px solid #fbbf24; }
.prms-cell-last-winner { background: linear-gradient(90deg, rgba(235,244,255,0.7), rgba(235,244,255,0.25)) !important; border-left:4px solid #60a5fa; }

/* Recent pulsing cell */
.prms-cell-recent { background: linear-gradient(90deg, rgba(220,38,38,0.15), rgba(220,38,38,0.05)) !important; animation: prms-pulse 1.6s ease-in-out infinite; border-left:4px solid rgba(220,38,38,0.6); }
@keyframes prms-pulse { 0%{box-shadow: inset 0 0 0 0 rgba(220,38,38,0.14);} 50%{box-shadow: inset 0 0 0 10px rgba(220,38,38,0.02);} 100%{box-shadow: inset 0 0 0 0 rgba(220,38,38,0.14);} }

/* Overall Results specific column widths */
.prms-modern-table thead th.col-rank,
.prms-modern-table tbody td.col-rank { 
    width: 3%; 
    text-align: center;
}

.prms-modern-table thead th.col-pic,
.prms-modern-table tbody td.col-pic { 
    width: 8%; 
    text-align: center;
}

.prms-modern-table thead th.col-competitor { 
    width: 22%; 
}

.prms-modern-table tbody td.col-competitor { 
    width: 22%; 
}

.prms-modern-table thead th.col-pigeons,
.prms-modern-table tbody td.col-pigeons { 
    width: 10%; 
    text-align: center;
}

.prms-modern-table thead th.col-date,
.prms-modern-table tbody td.col-date { 
    width: auto; 
    min-width: 100px;
    text-align: center;
}

.prms-modern-table thead th.col-total,
.prms-modern-table tbody td.col-total { 
    width: 12%; 
    text-align: center;
    font-weight: 700;
    background: rgba(102, 126, 234, 0.08) !important;
}

/* Medal styling for Overall Results */
.prms-medal {
    display: inline-block;
    margin-right: 6px;
    font-size: 16px;
    vertical-align: middle;
}

/* Competitor meta for Overall Results */
.prms-competitor-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prms-competitor-city {
    font-size: 12px;
    color: #6b7280;
    font-weight: normal;
}

/* Make date columns distinct in Overall Results */
.prms-modern-table tbody td.col-date {
    background: rgba(249, 250, 251, 0.8);
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* Highlight the Total column header */
.prms-modern-table thead th.col-total {
    background: rgba(102, 126, 234, 0.12);
    color: #4f46e5;
}

/* Responsive adjustments for Overall Results */
@media (max-width: 900px) {
    .prms-modern-table thead th.col-date,
    .prms-modern-table tbody td.col-date { 
        min-width: 80px;
    }
    
    .prms-modern-table thead th.col-competitor,
    .prms-modern-table tbody td.col-competitor { 
        width: 20%; 
    }
}

/* Optional: Add a subtle background to the overall table to distinguish it */
.prms-overall-block .prms-tournament-results {
    background: linear-gradient(180deg, #ffffff, #fafbff);
    border: 1px solid rgba(102, 126, 234, 0.12);
}

/* Style for the overall title */
.prms-title-sub h3 {
    color: #4f46e5;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

/* Distinct styling for Overall Results table */
.prms-overall-block .prms-modern-table {
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.08);
}

.prms-overall-block .prms-modern-table thead th {
    background: linear-gradient(180deg, #eef2ff, #e0e7ff);
    color: #4f46e5;
}

.prms-overall-block .prms-modern-table tbody tr:nth-child(1) td {
    background: linear-gradient(90deg, rgba(255, 243, 205, 0.4), rgba(255, 243, 205, 0.2));
}

.prms-overall-block .prms-modern-table tbody tr:nth-child(2) td {
    background: linear-gradient(90deg, rgba(241, 245, 249, 0.3), rgba(241, 245, 249, 0.15));
}

.prms-overall-block .prms-modern-table tbody tr:nth-child(3) td {
    background: linear-gradient(90deg, rgba(250, 244, 236, 0.25), rgba(250, 244, 236, 0.1));
}

/* Cup indicator */
.prms-tab[data-target="#prms-panel-overall"] .prms-tab-date {
    background: #4f46e5;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 3px;
}

/* Mobile tweaks: keep premium look but adjust sizing */
@media (max-width:900px) {
  .prms-modern-table { width:1100px; border-radius:8px; }
  .prms-modern-table thead th, .prms-modern-table tbody td { padding:6px 8px; font-size:12px; }
  .prms-avatar, .prms-competitor-avatar { width:34px; height:34px; }
  .prms-winner-avatar, .prms-winner-avatar-initials { width:40px; height:40px; }
}

/* Utilities */
.prms-empty { color:#9aa4b2; }
.prms-empty-muted { color:#c1c7cf; }
.prms-alert { padding:8px; border-radius:8px; background:#fff7ed; color:#92400e; border:1px solid #ffe6cc; }
.prms-error { padding:8px; border-radius:6px; background:#fff0f6; color:#8b1d20; }

/* Container overlay premium border */
.prms-table-container { position: relative; border-radius: 12px; overflow: hidden; }
.prms-table-container::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  z-index: 1;
}