/**
 * WKF World Africa - OVERRIDE CSS
 * 
 * Diese Datei MUSS NACH dem Theme-Stylesheet geladen werden!
 * Enthält alle Rules mit maximaler Spezifität und !important
 * 
 * Einbindung in functions.php ODER im Header nach allen anderen CSS:
 * <link rel="stylesheet" href="style-override.css" />
 */

/* ==================== MAXIMALE SPEZIFITÄT ==================== */

/* Haupt-Container für mehr Kontrolle */
body .site-main .event-wrapper .weight-class-nav,
.site-main .event-wrapper .weight-class-nav,
body .weight-class-nav,
.weight-class-nav {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.2rem !important;
    max-width: 600px !important;
    margin: 0.5rem auto !important;
    padding: 10px !important;
    background: #fff !important;
    border-radius: 4px !important;
}

/* Gewichtsklassen-Links - ALLE möglichen Selektoren */
body .site-main .event-wrapper .weight-class-nav a,
.site-main .event-wrapper .weight-class-nav a,
body .weight-class-nav a,
.weight-class-nav a,
body .weight-class-nav > a,
.weight-class-nav > a,
body div.weight-class-nav a,
div.weight-class-nav a {
    display: inline-block !important;
    margin: 0 !important;
    padding: 0.3rem 0.6rem !important;
    background: #f5f5f5 !important;
    color: #333 !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    font-weight: normal !important;
    line-height: 1.2 !important;
    flex: 0 1 calc(33.333% - 0.2rem) !important;
    text-align: center !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    min-width: 140px !important;
    max-width: 200px !important;
    border: none !important;
    box-shadow: none !important;
}

/* Hover-Status */
body .weight-class-nav a:hover,
.weight-class-nav a:hover,
body .weight-class-nav a:active,
.weight-class-nav a:active {
    background: #0073aa !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Erste Spalte verbreitert - ALLE Selektoren */
body .site-main .ranking-table .ranking-platz,
.site-main .ranking-table .ranking-platz,
body .ranking-table .ranking-platz,
.ranking-table .ranking-platz,
body table.ranking-table td:first-child,
table.ranking-table td:first-child,
body .ranking-table td:nth-child(1),
.ranking-table td:nth-child(1) {
    white-space: nowrap !important;
    width: 12% !important;
    min-width: 80px !important;
    max-width: 100px !important;
    padding: 0.75rem !important;
}

/* Ranking Tabelle - volle Breite sicherstellen */
body .site-main .ranking-table,
.site-main .ranking-table,
body .ranking-table,
.ranking-table,
body table.ranking-table,
table.ranking-table {
    width: 100% !important;
    max-width: 1200px !important;
    border-collapse: collapse !important;
}

/* Thumbnail Popup - mit höchster Priorität */
body .site-main .ranking-table .thumbnail span,
.site-main .ranking-table .thumbnail span,
body .ranking-table .thumbnail span,
.ranking-table .thumbnail span,
body .ranking-table .thumbnail > span,
.ranking-table .thumbnail > span {
    display: none !important;
    position: absolute !important;
    bottom: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #f8f9fa !important;
    border: 1px solid #ddd !important;
    padding: 0.5rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    z-index: 9999 !important;
    white-space: nowrap !important;
    visibility: visible !important;
    top: auto !important;
    width: auto !important;
    border-radius: 4px !important;
}

body .ranking-table .thumbnail:hover span,
.ranking-table .thumbnail:hover span {
    display: block !important;
}

/* Flaggen */
body .ranking-table .flag,
.ranking-table .flag,
body img.flag,
img.flag {
    max-width: 24px !important;
    height: auto !important;
    vertical-align: middle !important;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    body .weight-class-nav,
    .weight-class-nav {
        max-width: 100% !important;
    }
    
    body .weight-class-nav a,
    .weight-class-nav a {
        flex: 0 1 calc(50% - 0.2rem) !important; /* 2 Spalten auf Tablet */
    }
    
    body .ranking-table .ranking-platz,
    .ranking-table .ranking-platz {
        width: 10% !important;
        min-width: 60px !important;
    }
}

@media (max-width: 480px) {
    body .weight-class-nav a,
    .weight-class-nav a {
        flex: 0 1 100% !important; /* 1 Spalte auf Mobile */
        min-width: auto !important;
        max-width: none !important;
    }
    
    body .ranking-table .ranking-platz,
    .ranking-table .ranking-platz {
        width: 12% !important;
        min-width: 50px !important;
    }
}

/* ==================== ALTE THEME-STYLES ÜBERSCHREIBEN ==================== */

/* Falls Theme eigene .thumbnail Styles hat */
body .thumbnail,
.thumbnail,
body a.thumbnail,
a.thumbnail {
    position: relative !important;
}

/* Falls Theme visibility: hidden verwendet */
body .thumbnail span,
.thumbnail span,
body .thumbnail > span,
.thumbnail > span {
    visibility: visible !important;
}

/* Alle divs die weight-class enthalten könnten */
body div[class*="weight"],
body div[class*="gewicht"],
body div[class*="weight-class"],
body div[class*="gewichtsklasse"] {
    /* Keine spezifischen Styles die unser Layout stören */
}
