/**
 * Tournament Full-Width Layout Override
 * Komplette Überarbeitung für volle Breite und bessere Lesbarkeit
 * @package team-exciting
 * @version 1.0.0
 */

/* ===================================
   UNIVERSAL OVERRIDE - MAXIMUM PRIORITY
   =================================== */

/* Kill ALL max-width constraints on tournament pages */
body[class*="trn"] *[class*="container"],
body[class*="tournament"] *[class*="container"],
body[class*="ladder"] *[class*="container"],
body[class*="game"] *[class*="container"] {
    max-width: none !important;
}

/* ===================================
   CONTAINER OVERRIDE - VOLLE BREITE
   =================================== */

/* AGGRESSIVE: Alle möglichen Container auf volle Breite */
.trn-container,
div.trn-container,
body .trn-container,
body[class*="trn"] .trn-container,
body[class*="tournament"] .trn-container,
body[class*="ladder"] .trn-container,
body[class*="game"] .trn-container,
body[class*="player"] .trn-container,
body[class*="team"] .trn-container,
body[class*="match"] .trn-container,
body[class*="challenge"] .trn-container,
body.post-type-archive-trn-tournament .trn-container,
body.single-trn-tournament .trn-container,
body.post-type-archive-trn-ladder .trn-container,
body.single-trn-ladder .trn-container,
body.post-type-archive-trn_game .trn-container,
body.single-trn_game .trn-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 50px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

/* Wrapper und Parent Container auch erwischen */
.trn-container > *,
.trn-container .trn-wrapper,
.trn-container .container,
.trn-container .row {
    max-width: 100% !important;
    width: 100% !important;
}

/* ===================================
   TOURNAMENT GRID - VOLLE BREITE
   =================================== */

/* Tournament Row - Volle Breite ohne Begrenzung - ALLE Seiten */
body.post-type-archive-trn-tournament .trn-row,
body.post-type-archive-trn-ladder .trn-row,
body.post-type-archive-trn_game .trn-row,
body[class*="tournament"] .trn-row:not(#games),
body[class*="ladder"] .trn-row:not(#games),
body[class*="game"] .trn-row:not(#games),
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) {
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 30px 0 !important;
    padding: 0 !important;
}

/* CRITICAL: Override Bootstrap columns - Das ist das Hauptproblem! */
.trn-row .trn-col-sm-6,
.trn-row [class*="trn-col-"],
body.post-type-archive-trn-tournament .trn-row > div,
body.post-type-archive-trn-ladder .trn-row > div,
body.post-type-archive-trn_game .trn-row > div {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
}

/* ===================================
   TOURNAMENT CARD - NEUE STRUKTUR
   =================================== */

/* Tournament Item Wrapper - Volle Breite Horizontal Card - ALLE Seiten */
body.post-type-archive-trn-tournament .tournament,
body.post-type-archive-trn-ladder .ladder,
body.post-type-archive-trn_game .game,
body[class*="tournament"] .tournament,
body[class*="ladder"] .ladder,
body[class*="game"] .game {
    width: 100% !important;
    max-width: 100% !important;
}

body.post-type-archive-trn-tournament .trn-item-wrapper,
body.post-type-archive-trn-ladder .trn-item-wrapper,
body.post-type-archive-trn_game .trn-item-wrapper,
body[class*="tournament"] .trn-row:not(#games) .trn-item-wrapper,
body[class*="ladder"] .trn-row:not(#games) .trn-item-wrapper,
body[class*="game"] .trn-row:not(#games) .trn-item-wrapper,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-wrapper {
    display: grid !important;
    grid-template-columns: 400px 1fr 400px !important;
    gap: 0 !important;
    width: 100% !important;
    min-height: 250px !important;
    height: auto !important;
    background: linear-gradient(145deg, rgba(26, 26, 26, 0.95), rgba(37, 37, 37, 0.95)) !important;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

body.post-type-archive-trn-tournament .trn-item-wrapper:hover,
body.post-type-archive-trn-ladder .trn-item-wrapper:hover,
body.post-type-archive-trn_game .trn-item-wrapper:hover,
body[class*="tournament"] .trn-row:not(#games) .trn-item-wrapper:hover,
body[class*="ladder"] .trn-row:not(#games) .trn-item-wrapper:hover,
body[class*="game"] .trn-row:not(#games) .trn-item-wrapper:hover,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-wrapper:hover {
    transform: translateY(-5px) !important;
    border-color: var(--trn-primary) !important;
    box-shadow: 0 20px 60px rgba(255, 50, 51, 0.4) !important;
}

/* Item Group - Contents Display */
body.post-type-archive-trn-tournament .trn-item-group,
body.post-type-archive-trn-ladder .trn-item-group,
body.post-type-archive-trn_game .trn-item-group,
body[class*="tournament"] .trn-row:not(#games) .trn-item-group,
body[class*="ladder"] .trn-row:not(#games) .trn-item-group,
body[class*="game"] .trn-row:not(#games) .trn-item-group,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-group {
    display: contents !important;
}

/* ===================================
   THUMBNAIL - LINKS
   =================================== */

body.post-type-archive-trn-tournament .trn-item-thumbnail,
body.post-type-archive-trn-ladder .trn-item-thumbnail,
body.post-type-archive-trn_game .trn-item-thumbnail,
body[class*="tournament"] .trn-row:not(#games) .trn-item-thumbnail,
body[class*="ladder"] .trn-row:not(#games) .trn-item-thumbnail,
body[class*="game"] .trn-row:not(#games) .trn-item-thumbnail,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-thumbnail {
    width: 400px !important;
    height: 100% !important;
    min-height: 250px !important;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px !important;
    position: relative !important;
    overflow: hidden !important;
}

body.post-type-archive-trn-tournament .trn-item-thumbnail img,
body.post-type-archive-trn-ladder .trn-item-thumbnail img,
body.post-type-archive-trn_game .trn-item-thumbnail img,
body[class*="tournament"] .trn-row:not(#games) .trn-item-thumbnail img,
body[class*="ladder"] .trn-row:not(#games) .trn-item-thumbnail img,
body[class*="game"] .trn-row:not(#games) .trn-item-thumbnail img,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    max-height: 180px !important;
    transition: transform 0.3s ease !important;
    padding: 0 !important;
}

body.post-type-archive-trn-tournament .trn-item-wrapper:hover .trn-item-thumbnail img,
body.post-type-archive-trn-ladder .trn-item-wrapper:hover .trn-item-thumbnail img,
body.post-type-archive-trn_game .trn-item-wrapper:hover .trn-item-thumbnail img,
body[class*="tournament"] .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-thumbnail img,
body[class*="ladder"] .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-thumbnail img,
body[class*="game"] .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-thumbnail img,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-wrapper:hover .trn-item-thumbnail img {
    transform: scale(1.1) !important;
}

/* ===================================
   INFO - MITTE (FLEXIBEL)
   =================================== */

body.post-type-archive-trn-tournament .trn-item-info,
body.post-type-archive-trn-ladder .trn-item-info,
body.post-type-archive-trn_game .trn-item-info,
body[class*="tournament"] .trn-row:not(#games) .trn-item-info,
body[class*="ladder"] .trn-row:not(#games) .trn-item-info,
body[class*="game"] .trn-row:not(#games) .trn-item-info,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-info {
    padding: 35px 45px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 20px !important;
    min-height: 250px !important;
    flex: 1 !important;
    background: rgba(0, 0, 0, 0.15) !important;
}

/* Title - Gut lesbar */
body.post-type-archive-trn-tournament .trn-item-title,
body.post-type-archive-trn-ladder .trn-item-title,
body.post-type-archive-trn_game .trn-item-title,
body[class*="tournament"] .trn-row:not(#games) .trn-item-title,
body[class*="ladder"] .trn-row:not(#games) .trn-item-title,
body[class*="game"] .trn-row:not(#games) .trn-item-title,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-title {
    font-size: 32px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    margin-bottom: 12px !important;
    min-height: auto !important;
    color: #fff !important;
    transition: color 0.3s ease !important;
    display: block !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
}

body.post-type-archive-trn-tournament .trn-item-wrapper:hover .trn-item-title,
body.post-type-archive-trn-ladder .trn-item-wrapper:hover .trn-item-title,
body.post-type-archive-trn_game .trn-item-wrapper:hover .trn-item-title,
body[class*="tournament"] .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-title,
body[class*="ladder"] .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-title,
body[class*="game"] .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-title,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-wrapper:hover .trn-item-title {
    color: var(--trn-primary) !important;
    text-shadow: 0 0 20px rgba(255, 50, 51, 0.6) !important;
}

/* Meta Badges - Übersichtlich */
body.post-type-archive-trn-tournament .trn-item-meta,
body.post-type-archive-trn-ladder .trn-item-meta,
body.post-type-archive-trn_game .trn-item-meta,
body[class*="tournament"] .trn-row:not(#games) .trn-item-meta,
body[class*="ladder"] .trn-row:not(#games) .trn-item-meta,
body[class*="game"] .trn-row:not(#games) .trn-item-meta,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-meta {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
    margin-right: 12px !important;
    padding: 10px 20px !important;
    background: rgba(56, 255, 30, 0.12) !important;
    border: 1px solid rgba(56, 255, 30, 0.3) !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: var(--trn-secondary) !important;
    width: fit-content !important;
}

body.post-type-archive-trn-tournament .trn-item-meta a,
body.post-type-archive-trn-ladder .trn-item-meta a,
body.post-type-archive-trn_game .trn-item-meta a,
body[class*="tournament"] .trn-row:not(#games) .trn-item-meta a,
body[class*="ladder"] .trn-row:not(#games) .trn-item-meta a,
body[class*="game"] .trn-row:not(#games) .trn-item-meta a,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-meta a {
    color: var(--trn-secondary) !important;
    text-decoration: none !important;
}

/* ===================================
   STATS - RECHTS
   =================================== */

body.post-type-archive-trn-tournament .trn-item-list,
body.post-type-archive-trn-ladder .trn-item-list,
body.post-type-archive-trn_game .trn-item-list,
body[class*="tournament"] .trn-row:not(#games) .trn-item-list,
body[class*="ladder"] .trn-row:not(#games) .trn-item-list,
body[class*="game"] .trn-row:not(#games) .trn-item-list,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-list {
    padding: 35px 30px !important;
    margin: 0 !important;
    border-left: 2px solid rgba(255, 50, 51, 0.2) !important;
    border-top: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-around !important;
    gap: 20px !important;
    min-height: 250px !important;
    width: 400px !important;
    background: rgba(255, 50, 51, 0.05) !important;
    list-style: none !important;
}

body.post-type-archive-trn-tournament .trn-item-list-item,
body.post-type-archive-trn-ladder .trn-item-list-item,
body.post-type-archive-trn_game .trn-item-list-item,
body[class*="tournament"] .trn-row:not(#games) .trn-item-list-item,
body[class*="ladder"] .trn-row:not(#games) .trn-item-list-item,
body[class*="game"] .trn-row:not(#games) .trn-item-list-item,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-list-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 !important;
    padding: 18px 12px !important;
    background: rgba(255, 50, 51, 0.1) !important;
    border: 1px solid rgba(255, 50, 51, 0.2) !important;
    border-radius: 12px !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
    max-width: none !important;
}

body.post-type-archive-trn-tournament .trn-item-list-item:hover,
body.post-type-archive-trn-ladder .trn-item-list-item:hover,
body.post-type-archive-trn_game .trn-item-list-item:hover,
body[class*="tournament"] .trn-row:not(#games) .trn-item-list-item:hover,
body[class*="ladder"] .trn-row:not(#games) .trn-item-list-item:hover,
body[class*="game"] .trn-row:not(#games) .trn-item-list-item:hover,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-list-item:hover {
    background: rgba(255, 50, 51, 0.2) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgba(255, 50, 51, 0.4) !important;
}

body.post-type-archive-trn-tournament .trn-item-list-item strong,
body.post-type-archive-trn-ladder .trn-item-list-item strong,
body.post-type-archive-trn_game .trn-item-list-item strong,
body[class*="tournament"] .trn-row:not(#games) .trn-item-list-item strong,
body[class*="ladder"] .trn-row:not(#games) .trn-item-list-item strong,
body[class*="game"] .trn-row:not(#games) .trn-item-list-item strong,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-list-item strong {
    font-size: 36px !important;
    font-weight: 900 !important;
    display: block !important;
    color: var(--trn-primary) !important;
    line-height: 1 !important;
}

body.post-type-archive-trn-tournament .trn-item-list-item span,
body.post-type-archive-trn-ladder .trn-item-list-item span,
body.post-type-archive-trn_game .trn-item-list-item span,
body[class*="tournament"] .trn-row:not(#games) .trn-item-list-item span,
body[class*="ladder"] .trn-row:not(#games) .trn-item-list-item span,
body[class*="game"] .trn-row:not(#games) .trn-item-list-item span,
.trn-row:not(#games):not(.trn-teams-grid):not(.trn-players-grid) .trn-item-list-item span {
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 600 !important;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 1400px) {
    body.post-type-archive-trn-tournament .trn-container,
    body[class*="tournament"] .trn-container {
        padding: 0 30px !important;
    }

    body.post-type-archive-trn-tournament .trn-item-wrapper,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-wrapper {
        grid-template-columns: 350px 1fr 350px !important;
    }

    body.post-type-archive-trn-tournament .trn-item-thumbnail,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-thumbnail {
        width: 350px !important;
    }

    body.post-type-archive-trn-tournament .trn-item-list,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-list {
        width: 350px !important;
    }
}

@media (max-width: 1024px) {
    body.post-type-archive-trn-tournament .trn-item-wrapper,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-wrapper {
        grid-template-columns: 1fr !important;
        grid-template-rows: 220px auto auto !important;
    }

    body.post-type-archive-trn-tournament .trn-item-thumbnail,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-thumbnail {
        width: 100% !important;
        height: 220px !important;
        min-height: 220px !important;
    }

    body.post-type-archive-trn-tournament .trn-item-list,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-list {
        width: 100% !important;
        border-left: none !important;
        border-top: 2px solid rgba(255, 50, 51, 0.2) !important;
        min-height: auto !important;
        padding: 25px !important;
    }
}

@media (max-width: 768px) {
    body.post-type-archive-trn-tournament .trn-container,
    body[class*="tournament"] .trn-container {
        padding: 0 20px !important;
    }

    body.post-type-archive-trn-tournament .trn-item-title,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-title {
        font-size: 24px !important;
    }

    body.post-type-archive-trn-tournament .trn-item-info,
    body[class*="tournament"] .trn-row:not(#games) .trn-item-info {
        padding: 25px 30px !important;
    }
}
