/* =============================================================
   Turnier Wertung – Frontend Styles
   Sauberes, modernes Sportdesign
   ============================================================= */

:root {
    --tw-bg:          #0f1117;
    --tw-bg-card:     #1a1d27;
    --tw-bg-row:      #1e2130;
    --tw-border:      rgba(255,255,255,0.07);
    --tw-accent:      #917852;
    --tw-accent-light:#b5996a;
    --tw-text:        #e8eaf2;
    --tw-text-muted:  #6b7280;
    --tw-gold:        #917852;
    --tw-silver:      #b0bec5;
    --tw-bronze:      #cd7f32;
    --tw-green:       #4caf82;
    --tw-mid:         #4a9de8;
    --tw-red:         #e85050;
    --tw-radius:      12px;
    --tw-radius-sm:   6px;
    --tw-font:        inherit;
    --tw-font-mono:   inherit;
    --tw-shadow:      0 4px 24px rgba(0,0,0,0.4);
}

/* Import font */


/* ---- Wrapper ---- */
.tw-wrap {
    font-family: inherit;
    color: var(--tw-text);
    width: 100%;
}

/* ---- Table ---- */
.tw-table-wrap {
    overflow-x: auto;
    border-radius: var(--tw-radius);
    background: var(--tw-bg-card);
    box-shadow: var(--tw-shadow);
    width: 100%;
}

.tw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tw-table thead tr {
    background: rgba(255,255,255,0.04);
    border-bottom: 2px solid var(--tw-accent);
}

.tw-table thead th {
    padding: 0.85rem 0.75rem;
    text-align: center;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tw-text-muted);
    white-space: nowrap;
}

.tw-table thead th.tw-col-team {
    text-align: left;
}

.tw-table tbody tr {
    border-bottom: 1px solid var(--tw-border);
    transition: background 0.15s ease;
}

.tw-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.tw-table tbody tr:last-child {
    border-bottom: none;
}

.tw-table td {
    padding: 0.9rem 0.75rem;
    text-align: center;
    vertical-align: top;
}

/* ---- Cols ---- */
.tw-col-platz {
    width: 44px;
}

.tw-col-team {
    text-align: left !important;
    min-width: 160px;
}

.tw-col-total {
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--tw-accent-light);
    min-width: 48px;
}

.tw-col-st {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 42px;
    color: var(--tw-text-muted);
}

/* ---- Platz Badge ---- */
.tw-platz {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(255,255,255,0.06);
    color: var(--tw-text-muted);
}

/* ---- Medal rows ---- */
.tw-row.tw-gold {
    background: rgba(145, 120, 82, 0.08);
}
.tw-row.tw-gold .tw-platz {
    background: var(--tw-gold);
    color: #fff;
}
.tw-row.tw-silver {
    background: rgba(176, 190, 197, 0.05);
}
.tw-row.tw-silver .tw-platz {
    background: var(--tw-silver);
    color: #111;
}
.tw-row.tw-bronze .tw-platz {
    background: var(--tw-bronze);
    color: #fff;
}

/* ---- Clickable rows ---- */
.tw-row--clickable {
    cursor: pointer;
    user-select: none;
}
.tw-row--clickable:hover .tw-team-name {
    color: var(--tw-accent-light);
}
.tw-expand-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--tw-text-muted);
    transition: transform 0.2s ease;
    vertical-align: middle;
    line-height: 1;
}
.tw-row--open .tw-expand-icon {
    transform: rotate(90deg);
    color: var(--tw-accent);
}

/* ---- Expand row ---- */
.tw-row-expand td {
    padding: 0 !important;
}
.tw-expand-cell {
    background: rgba(145, 120, 82, 0.05);
    border-bottom: 1px solid var(--tw-border);
}
.tw-expand-inner {
    padding: 0.85rem 1.25rem 0.85rem 3.5rem;
    display: flex;
    gap: 1rem;
    align-items: baseline;
}
.tw-expand-label {
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tw-accent);
    white-space: nowrap;
    flex-shrink: 0;
}
.tw-expand-spieler {
    margin: 0;
    font-size: 0.85rem;
    color: var(--tw-text-muted);
    line-height: 1.6;
	text-align:left;
}

/* ---- Team cell ---- */
.tw-team-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--tw-text);
}
.tw-team-abk {
    display: block;
    font-family: inherit;
    font-size: 0.72rem;
    color: var(--tw-text-muted);
    letter-spacing: 0.06em;
    margin-top: 1px;
}

/* ---- Punkt-Farben ---- */
.tw-pkt-high {
    color: var(--tw-green) !important;
    font-weight: 700 !important;
}
.tw-pkt-mid {
    color: var(--tw-mid) !important;
}
.tw-abwesend {
    color: var(--tw-red) !important;
    font-size: 0.78rem !important;
}
.tw-ausstehend {
    color: var(--tw-text-muted) !important;
    font-size: 0.8rem !important;
}

/* ============================================================
   SPIELPLAN
   ============================================================ */

.tw-spielplan-section {
    margin-bottom: 2rem;
    width: 100%;
}

.tw-section-title {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tw-text-muted);
    margin: 0 0 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--tw-border);
}

.tw-spieltage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
    width: 100%;
	align-items: start;
}

/* ---- Card ---- */
.tw-spieltag-card {
    background: var(--tw-bg-card);
    border-radius: var(--tw-radius);
    padding: 1.1rem 1.25rem 1rem;
    border: 1px solid var(--tw-border);
    transition: border-color 0.2s ease;
}
.tw-spieltag-card:hover {
    border-color: rgba(255,255,255,0.14);
}

.tw-status-aktiv,
.tw-status-aktiv .tw-card-status {
    border-color: var(--tw-accent) !important;
    box-shadow: 0 0 0 1px rgba(232, 200, 74, 0.2);
}

.tw-status-aktiv .tw-card-status{
	background: rgba(22, 163, 74, 0.2);
	color: #bbf7d0;
}

.tw-status-vergangen {
    opacity: 0.75;
}

.tw-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.tw-card-titel {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tw-text);
}

.tw-card-status {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    background: rgba(255,255,255,0.07);
    color: var(--tw-text-muted);
}
.tw-status-heute .tw-card-status {
    background: var(--tw-accent);
    color: #fff;
}
.tw-status-vergangen .tw-card-status {
    background: rgba(76,175,130,0.15);
    color: var(--tw-green);
}

.tw-card-datum {
    font-size: 0.78rem;
    color: var(--tw-text-muted);
    margin-bottom: 0.85rem;
}

/* ---- Spiele Liste ---- */
.tw-spiele-liste {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tw-spiel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--tw-radius-sm);
    font-size: 0.82rem;
    background: rgba(255,255,255,0.03);
}

.tw-spiel.tw-gespielt {
    background: rgba(255,255,255,0.04);
}

.tw-team-a {
    text-align: right;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--tw-text);
}

.tw-team-b {
    text-align: left;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--tw-text);
}

.tw-resultat {
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--tw-accent);
    white-space: nowrap;
    text-align: center;
    min-width: 42px;
    padding: 0 0.25rem;
}

.tw-spiel:not(.tw-gespielt) .tw-resultat {
    color: var(--tw-text-muted);
    font-weight: 400;
    font-size: 0.78rem;
}

.tw-abwesend-hinweis {
    margin: 0.6rem 0 0;
    font-size: 0.74rem;
    color: var(--tw-red);
    opacity: 0.8;
}

.tw-keine-spiele {
    font-size: 0.8rem;
    color: var(--tw-text-muted);
    font-style: italic;
    margin: 0.5rem 0 0;
}

.tw-empty {
    color: var(--tw-text-muted);
    font-style: italic;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .tw-title { font-size: 1.4rem; }
    .tw-table { font-size: 0.78rem; }
    .tw-table td, .tw-table th { padding: 0.65rem 0.4rem; }
    .tw-team-name { font-size: 0.82rem; }
    .tw-spieltage-grid { grid-template-columns: 1fr; }
}

/* ---- Live-Button in Spielplan-Karte ---- */
.tw-live-card-btn {
    display: block;
    margin-top: 0.85rem;
    padding: 0.5rem 1rem;
    background: #917852;
    color: #fff !important;
    text-align: center;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}
.tw-live-card-btn:hover { opacity: 0.85; }

/* ---- Heutiger Spieltag: two-col layout ---- */
.tw-heute-layout {
    display: block;
}
.tw-heute-layout--with-auswertung {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
    gap: 1.25rem;
    align-items: start;
}

/* Desktop: card left, auswertung right, always open */
@media (min-width: 769px) {
    .tw-heute-card-col      { order: 1; }
    .tw-auswertung-details  { order: 2; }
    .tw-auswertung-summary  { cursor: default; pointer-events: none; }
    .tw-auswertung-chevron  { display: none; }
}

/* Mobile: accordion on top (order 1), card below (order 2) */
@media (max-width: 768px) {
    .tw-heute-layout--with-auswertung {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    .tw-heute-card-col     { order: 2; width: 100%; }
    .tw-auswertung-details { order: 1; max-width: 100%; }
}

/* ---- Live-Auswertung accordion (details/summary) ---- */
.tw-auswertung-details {
    border-radius: var(--tw-radius);
    background: var(--tw-bg-card);
    border: 1px solid var(--tw-border);
    overflow: clip; /* clips border-radius without blocking descendant scroll */
}
.tw-auswertung-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tw-text-muted);
    border-bottom: 1px solid var(--tw-border);
    user-select: none;
}
.tw-auswertung-summary::-webkit-details-marker { display: none; }
.tw-auswertung-summary::marker                 { display: none; }
.tw-auswertung-chevron {
    margin-left: auto;
    font-size: 1rem;
    transition: transform 0.2s ease;
    color: var(--tw-text-muted);
}
.tw-auswertung-details[open] .tw-auswertung-chevron {
    transform: rotate(180deg);
}
.tw-auswertung-details .tw-table-wrap {
    border-radius: 0;
    box-shadow: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Live-Auswertung table styles ---- */
.tw-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #dc2626;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    vertical-align: middle;
    animation: tw-pulse 1.8s ease-in-out infinite;
}
.tw-live-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: tw-dot-pulse 1.8s ease-in-out infinite;
}
@keyframes tw-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.75; }
}
@keyframes tw-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.75); }
}
.tw-live-progress {
    font-size: 0.78rem;
    font-weight: 400;
    color: #6b7280;
}
.tw-table--live-auswertung {
    width: 100%;
}
.tw-table--live-auswertung .tw-col-platz   { width: 2.5rem; text-align: center; }
.tw-table--live-auswertung .tw-col-sp,
.tw-table--live-auswertung .tw-col-rp      { text-align: center; }
.tw-table--live-auswertung .tw-col-wertung { text-align: center; color: #6b7280; font-size: 0.85rem; }
.tw-table--live-auswertung .tw-col-total   { width: 6.5rem; text-align: center; }
.tw-table--live-auswertung .tw-col-team    { text-align: left; }
.tw-row--abwesend td { opacity: 0.45; font-style: italic; }
.tw-abwesend-label   { font-size: 0.8rem; color: #9ca3af; }
.tw-platz--na        { color: #9ca3af; }

/* ---- Live open button ---- */
.tw-live-open-btn {
    margin-bottom: 0.75rem;
}
