/**
 * Tournament Plugin - Modern Layouts
 * Komplett überarbeitetes Layout-System für alle Archive-Seiten
 * @package team-exciting
 * @version 1.0.0
 */

/* ===================================
   GAMES LAYOUT - HORIZONTAL CARDS
   =================================== */

/* Games Grid - Full Width Cards */
#games.trn-row {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 30px;
    width: 100%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Game Card - Horizontal Layout */
#games .trn-item-wrapper {
    display: grid;
    grid-template-columns: 400px 1fr 280px;
    gap: 0;
    min-height: 300px;
    height: auto;
    background: linear-gradient(90deg, rgba(26, 26, 26, 0.95) 0%, rgba(37, 37, 37, 0.95) 100%);
    cursor: pointer;
    transition: all 0.3s ease;
}

#games .trn-item-wrapper:hover {
    transform: translateX(5px);
}

#games .trn-item-group {
    display: contents;
}

/* Game Thumbnail - Left Side */
#games .trn-item-thumbnail {
    width: 400px;
    height: 100%;
    min-height: 300px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 45px;
    position: relative;
    overflow: visible;
}

#games .trn-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0;
    max-height: 240px;
}

/* Game Info - Center */
#games .trn-item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 60px;
    gap: 20px;
    min-height: 300px;
}

#games .trn-item-title {
    font-size: 34px;
    min-height: auto;
    margin-bottom: 15px;
    line-height: 1.3;
}

#games .trn-item-meta {
    margin-bottom: 5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#games .trn-item-meta::before {
    content: '⚔️';
    font-size: 16px;
}

#games .trn-item-meta:nth-of-type(2)::before {
    content: '🏆';
}

/* Platform Badge - Right Side */
#games .trn-item-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 45px;
    margin: 0;
    border-top: none;
    border-left: 2px solid rgba(255, 50, 51, 0.2);
    background: rgba(255, 50, 51, 0.05);
    min-height: 300px;
    width: 280px;
}

#games .trn-item-list-item {
    flex-direction: column;
    max-width: none;
    gap: 15px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

#games .trn-item-list-item.platform::before {
    font-size: 48px;
    margin-right: 0;
    margin-bottom: 10px;
    animation: gamepadBounce 2s ease-in-out infinite;
}

@keyframes gamepadBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(-5deg);
    }
    50% {
        transform: translateY(0) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* ===================================
   TOURNAMENTS LAYOUT - CLEAN HORIZONTAL LIKE LADDERS
   =================================== */

/* Tournament Layout - Horizontal List like Ladders */
.trn-row:not(#games):not([class*="trn-ladder"]) {
    display: flex !important;
    flex-direction: column !important;
    gap: 25px !important;
    margin-top: 30px;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}

/* Tournament Card - Horizontal Layout like Ladders */
.tournament .trn-item-wrapper,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-wrapper {
    display: grid;
    grid-template-columns: 320px 1fr 350px;
    gap: 0;
    min-height: 220px;
    height: auto;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(26, 26, 26, 0.95), rgba(37, 37, 37, 0.95));
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.tournament .trn-item-wrapper:hover,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-wrapper:hover {
    transform: translateY(-5px);
    border-color: var(--trn-primary);
    box-shadow: 0 15px 40px rgba(255, 50, 51, 0.4);
}

.tournament .trn-item-group,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-group {
    display: contents;
}

/* Tournament Thumbnail - Left Side like Ladders */
.tournament .trn-item-thumbnail,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-thumbnail {
    width: 320px;
    height: 100%;
    min-height: 220px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
    overflow: visible;
}

.tournament .trn-item-thumbnail img,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 160px;
    transition: transform 0.3s ease;
}

.tournament .trn-item-wrapper:hover .trn-item-thumbnail img,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-thumbnail img {
    transform: scale(1.08);
}

/* Tournament Info - Center like Ladders */
.tournament .trn-item-info,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-info {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    min-height: 220px;
}

.tournament .trn-item-title,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 10px;
    min-height: auto;
    color: #fff;
    transition: color 0.3s ease;
}

.tournament .trn-item-wrapper:hover .trn-item-title,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-wrapper:hover .trn-item-title {
    color: var(--trn-primary);
}

/* Meta Badges */
.tournament .trn-item-meta,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    margin-right: 10px;
    padding: 8px 16px;
    background: rgba(56, 255, 30, 0.12);
    border: 1px solid rgba(56, 255, 30, 0.3);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--trn-secondary);
    width: fit-content;
}

/* Tournament Stats - Right Side like Ladders */
.tournament .trn-item-list,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-list {
    padding: 30px 35px;
    margin: 0;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    gap: 25px;
    min-height: 220px;
    min-width: 350px;
    background: rgba(0, 0, 0, 0.2);
}

.tournament .trn-item-list-item,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-list-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 15px;
    background: rgba(255, 50, 51, 0.08);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    max-width: none;
}

.tournament .trn-item-list-item:hover,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-list-item:hover {
    background: rgba(255, 50, 51, 0.15);
    transform: translateY(-3px);
}

.tournament .trn-item-list-item strong,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-list-item strong {
    font-size: 32px;
    font-weight: 900;
    display: block;
    color: var(--trn-primary);
}

.tournament .trn-item-list-item span,
body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-list-item span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

/* ===================================
   LADDERS LAYOUT - LIST VIEW
   =================================== */

/* Ladders as Horizontal List Cards */
body[class*="trn-ladder"] .trn-row,
.archive.post-type-archive-trn-ladder .trn-row {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

body[class*="trn-ladder"] .trn-item-wrapper,
.archive.post-type-archive-trn-ladder .trn-item-wrapper {
    display: grid;
    grid-template-columns: 320px 1fr 350px;
    min-height: 220px;
    height: auto;
}

body[class*="trn-ladder"] .trn-item-group,
.archive.post-type-archive-trn-ladder .trn-item-group {
    display: contents;
}

/* Ladder Thumbnail */
body[class*="trn-ladder"] .trn-item-thumbnail,
.archive.post-type-archive-trn-ladder .trn-item-thumbnail {
    width: 320px;
    height: 100%;
    min-height: 220px;
    padding: 30px;
}

body[class*="trn-ladder"] .trn-item-thumbnail img,
.archive.post-type-archive-trn-ladder .trn-item-thumbnail img {
    max-height: 160px;
}

/* Ladder Info */
body[class*="trn-ladder"] .trn-item-info,
.archive.post-type-archive-trn-ladder .trn-item-info {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
}

body[class*="trn-ladder"] .trn-item-title,
.archive.post-type-archive-trn-ladder .trn-item-title {
    font-size: 28px;
    min-height: auto;
}

/* Ladder Stats */
body[class*="trn-ladder"] .trn-item-list,
.archive.post-type-archive-trn-ladder .trn-item-list {
    padding: 30px 35px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    display: flex;
    flex-direction: row;
    gap: 25px;
    min-width: 350px;
}

body[class*="trn-ladder"] .trn-item-list-item,
.archive.post-type-archive-trn-ladder .trn-item-list-item {
    flex-direction: column;
    max-width: none;
    gap: 10px;
    padding: 15px;
}

/* ===================================
   PLAYERS & TEAMS LAYOUT
   =================================== */

/* Players/Teams Grid */
body[class*="trn-player"] .trn-row,
body[class*="trn-team"] .trn-row,
.archive.post-type-archive-trn-player .trn-row,
.archive.post-type-archive-trn-team .trn-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* Player/Team Card */
body[class*="trn-player"] .trn-item-wrapper,
body[class*="trn-team"] .trn-item-wrapper,
.archive.post-type-archive-trn-player .trn-item-wrapper,
.archive.post-type-archive-trn-team .trn-item-wrapper {
    min-height: 500px;
}

/* ===================================
   MATCHES LAYOUT - Timeline Style
   =================================== */

body[class*="trn-match"] .trn-row,
.archive.post-type-archive-trn-match .trn-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

body[class*="trn-match"] .trn-item-wrapper,
.archive.post-type-archive-trn-match .trn-item-wrapper {
    display: flex;
    flex-direction: row;
    min-height: 120px;
    height: auto;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 1400px) {
    /* Games - Stack on Medium Screens */
    #games .trn-item-wrapper {
        grid-template-columns: 250px 1fr auto;
    }

    #games .trn-item-thumbnail {
        width: 250px;
        padding: 25px;
    }
}

@media (max-width: 1024px) {
    /* Games - Full Stack on Tablet */
    #games .trn-item-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 200px auto auto;
    }

    #games .trn-item-thumbnail {
        width: 100%;
        height: 200px;
        min-height: 200px;
        padding: 30px;
    }

    #games .trn-item-list {
        border-left: none;
        border-top: 2px solid rgba(255, 50, 51, 0.2);
        flex-direction: row;
        justify-content: center;
        min-height: auto;
        padding: 20px;
    }

    /* Ladders - Stack */
    body[class*="trn-ladder"] .trn-item-wrapper,
    .archive.post-type-archive-trn-ladder .trn-item-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 180px auto auto;
    }

    body[class*="trn-ladder"] .trn-item-thumbnail,
    .archive.post-type-archive-trn-ladder .trn-item-thumbnail {
        width: 100%;
    }

    body[class*="trn-ladder"] .trn-item-list,
    .archive.post-type-archive-trn-ladder .trn-item-list {
        border-left: none;
        border-top: 2px solid rgba(255, 255, 255, 0.1);
        min-width: auto;
        justify-content: space-around;
    }

    /* Tournaments - Stack on Tablet like Ladders */
    .tournament .trn-item-wrapper,
    body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 180px auto auto;
    }

    .tournament .trn-item-thumbnail,
    body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-thumbnail {
        width: 100%;
        height: 180px;
        min-height: 180px;
    }

    .tournament .trn-item-list,
    body:not([class*="trn-ladder"]) .trn-row:not(#games) .trn-item-list {
        border-left: none;
        border-top: 2px solid rgba(255, 255, 255, 0.1);
        min-width: auto;
        justify-content: space-around;
        min-height: auto;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    /* All Grids - Single Column */
    .trn-row,
    #games.trn-row,
    body[class*="trn-ladder"] .trn-row,
    body[class*="trn-player"] .trn-row,
    body[class*="trn-team"] .trn-row {
        grid-template-columns: 1fr !important;
    }

    /* Smaller Fonts */
    #games .trn-item-title,
    body[class*="trn-ladder"] .trn-item-title {
        font-size: 22px;
    }

    .tournament .trn-item-title,
    .trn-row:not(#games) .trn-item-title {
        font-size: 22px;
    }

    .tournament .trn-item-info,
    .trn-row:not(#games) .trn-item-info {
        padding: 25px 30px;
    }
}

@media (max-width: 480px) {
    /* Mobile Optimizations */
    #games .trn-item-info,
    body[class*="trn-ladder"] .trn-item-info {
        padding: 20px;
    }

    #games .trn-item-list {
        padding: 15px;
    }

    #games .trn-item-list-item.platform::before {
        font-size: 36px;
    }

    .tournament .trn-item-info,
    .trn-row:not(#games) .trn-item-info {
        padding: 20px;
    }

    .tournament .trn-item-list,
    .trn-row:not(#games) .trn-item-list {
        padding: 15px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .tournament .trn-item-list-item strong,
    .trn-row:not(#games) .trn-item-list-item strong {
        font-size: 24px;
    }
}

/* ===================================
   UTILITY CLASSES
   =================================== */

/* Ensure Overflow Visible for Effects */
.trn-col-lg-4,
.trn-col-sm-6 {
    overflow: visible;
}

/* Text Overflow Handling */
.trn-item-title {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    word-wrap: break-word;
}

/* Ensure Full Content Visibility */
.trn-item-info,
.trn-item-list {
    overflow: visible;
}
