/**
 * TOTW FUT.GG-Style Formation Layout (v2.1.0)
 * Fixed card sizes, correct positioning, no field cropping
 * 70/30 desktop split, single column mobile, filter-based navigation
 */

/* Main Container - Fits Parent Height */
.totw-futgg-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #0a0e27;
    color: #ffffff;
    overflow: hidden;
}

/* Top Info Bar - Fixed Height */
.totw-futgg-info-bar {
    background: #141b3d;
    border-bottom: 1px solid #334155;
    padding: 16px 24px;
    text-align: center;
    flex-shrink: 0;
    min-height: 80px;
}

.totw-futgg-title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.totw-futgg-meta {
    font-size: 14px;
    color: #9ca3af;
    font-weight: 400;
}

/* Content Area - 70/30 Split, Fits Remaining Space */
.totw-futgg-content-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left Column - Pitch (70%) */
.totw-futgg-pitch-column {
    flex: 0 0 70%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-width: 0;
    overflow: hidden;
}

/* Right Column - Player List (30%) */
.totw-futgg-players-column {
    flex: 0 0 30%;
    overflow-y: auto;
    padding: 24px;
    background: #141b3d;
    border-left: 1px solid #334155;
}

/* Pitch Container - No Cropping */
.totw-futgg-pitch-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    aspect-ratio: 0.67;
    background-image: url('../images/field.svg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
}

/* Pitch Overlay - Contains all player slots */
.totw-futgg-pitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* Player Slot Positioning - Base Styles */
.totw-futgg-player-slot {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.2s ease, z-index 0s;
}

.totw-futgg-player-slot:hover {
    transform: translate(-50%, -50%) scale(1.08);
    z-index: 100;
}

/* 3-5-2 Formation Positioning - Matches PHP Config Exactly */
.totw-futgg-player-slot[data-position="GK"] {
    left: 50%;
    top: 90%;
}

.totw-futgg-player-slot[data-position="CB"][data-index="1"] {
    left: 30%;
    top: 73%;
}

.totw-futgg-player-slot[data-position="CB"][data-index="2"] {
    left: 50%;
    top: 73%;
}

.totw-futgg-player-slot[data-position="CB"][data-index="3"] {
    left: 70%;
    top: 73%;
}

.totw-futgg-player-slot[data-position="LM"] {
    left: 25%;
    top: 38%;
}

.totw-futgg-player-slot[data-position="CDM"][data-index="1"] {
    left: 35%;
    top: 48%;
}

.totw-futgg-player-slot[data-position="CAM"] {
    left: 50%;
    top: 38%;
}

.totw-futgg-player-slot[data-position="CDM"][data-index="2"] {
    left: 65%;
    top: 48%;
}

.totw-futgg-player-slot[data-position="RM"] {
    left: 75%;
    top: 38%;
}

.totw-futgg-player-slot[data-position="ST"][data-index="1"] {
    left: 40%;
    top: 18%;
}

.totw-futgg-player-slot[data-position="ST"][data-index="2"] {
    left: 60%;
    top: 18%;
}

/* Player Card Design - FIXED DIMENSIONS */
.totw-futgg-player-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid #334155;
    border-radius: 10px;
    padding: 8px;
    width: 92px;
    height: 130px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
}

.totw-futgg-player-card.has-player {
    border-color: #d97706;
    background: linear-gradient(135deg, #2d1810 0%, #1a0f08 100%);
}

.totw-futgg-player-slot:hover .totw-futgg-player-card {
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.4);
}

/* Player Image - Fixed Size */
.totw-futgg-player-image {
    width: 55px;
    height: 55px;
    margin: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #4b5563;
    flex-shrink: 0;
}

.has-player .totw-futgg-player-image {
    border-color: #d97706;
}

.totw-futgg-player-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Player Name - Adapts to Card, Never Expands */
.totw-futgg-player-name {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    margin: 2px 0;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 76px;
    width: 100%;
    flex-shrink: 0;
    height: 12px;
}

/* Position Label - Fixed Height */
.totw-futgg-position-label {
    font-size: 9px;
    font-weight: 700;
    color: #d97706;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 2px 0;
    flex-shrink: 0;
    height: 10px;
    line-height: 1;
}

/* Player Score - Fixed Height */
.totw-futgg-player-score {
    font-size: 10px;
    font-weight: 700;
    color: #fbbf24;
    margin: 0;
    flex-shrink: 0;
    height: 12px;
    line-height: 1.2;
}

/* Empty Slot Styling */
.totw-futgg-player-card.empty-slot {
    border-color: #4b5563;
    opacity: 0.5;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

.totw-futgg-player-card.empty-slot .totw-futgg-player-name {
    color: #9ca3af;
}

/* Player List Section */
.totw-futgg-list-header {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 20px 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 12px;
    border-bottom: 2px solid #d97706;
}

.totw-futgg-list-item {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.totw-futgg-list-item:hover {
    border-color: #d97706;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}

.totw-futgg-list-item-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #374151;
    border: 2px solid #d97706;
}

.totw-futgg-list-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.totw-futgg-list-item-info {
    flex: 1;
    min-width: 0;
}

.totw-futgg-list-item-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.totw-futgg-list-item-position {
    font-size: 11px;
    color: #d97706;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.totw-futgg-list-item-team {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.totw-futgg-list-item-stats {
    text-align: right;
    font-size: 11px;
    color: #10b981;
    flex-shrink: 0;
}

.totw-futgg-list-item-score {
    font-size: 14px;
    font-weight: 700;
    color: #fbbf24;
    margin-top: 4px;
}

/* Highlighted State */
.totw-futgg-player-slot.highlighted .totw-futgg-player-card {
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.totw-futgg-list-item.active {
    border-color: #10b981;
    background: #1e3a2e;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* Dark Theme Scrollbar */
.totw-futgg-players-column::-webkit-scrollbar {
    width: 8px;
}

.totw-futgg-players-column::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.totw-futgg-players-column::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.totw-futgg-players-column::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Responsive - Large Desktop (maintain 70/30) */
@media (min-width: 1400px) {
    .totw-futgg-pitch-container {
        max-width: 800px;
    }
}

/* Responsive - Laptop */
@media (max-width: 1200px) {
    .totw-futgg-pitch-column {
        flex: 0 0 65%;
        padding: 20px 16px;
    }

    .totw-futgg-players-column {
        flex: 0 0 35%;
        padding: 20px;
    }

    .totw-futgg-pitch-container {
        max-width: 650px;
    }
}

/* Responsive - Tablet (Switch to Single Column) */
@media (max-width: 1024px) {
    /* Allow scrolling on mobile */
    .totw-futgg-container {
        height: auto;
        overflow: visible;
    }

    .totw-futgg-content-wrapper {
        flex-direction: column;
        overflow: visible;
    }

    .totw-futgg-pitch-column {
        flex: none;
        width: 100%;
        padding: 24px 16px;
        overflow: visible;
    }

    /* Players column BELOW field in document flow */
    .totw-futgg-players-column {
        width: 100%;
        flex: none;
        max-height: none;
        min-height: 300px;
        border-left: none;
        border-top: 2px solid #d97706;
        overflow-y: visible;
    }

    .totw-futgg-pitch-container {
        max-width: 600px;
    }

    /* Fixed card sizes for tablet */
    .totw-futgg-player-card {
        width: 80px;
        height: 115px;
        padding: 6px;
    }

    .totw-futgg-player-image {
        width: 48px;
        height: 48px;
    }

    .totw-futgg-player-name {
        font-size: 10px;
        max-width: 68px;
        height: 11px;
    }

    .totw-futgg-position-label {
        font-size: 8px;
        height: 9px;
    }

    .totw-futgg-player-score {
        font-size: 9px;
        height: 11px;
    }
}

/* Responsive - Mobile Portrait */
@media (max-width: 768px) {
    .totw-futgg-info-bar {
        padding: 12px 16px;
        min-height: 70px;
    }

    .totw-futgg-title {
        font-size: 18px;
    }

    .totw-futgg-meta {
        font-size: 12px;
    }

    .totw-futgg-pitch-column {
        padding: 20px 12px;
    }

    .totw-futgg-pitch-container {
        max-width: 500px;
    }

    .totw-futgg-players-column {
        min-height: 250px;
        padding: 16px;
    }

    /* Fixed card sizes for mobile */
    .totw-futgg-player-card {
        width: 70px;
        height: 105px;
        padding: 5px;
    }

    .totw-futgg-player-image {
        width: 42px;
        height: 42px;
    }

    .totw-futgg-player-name {
        font-size: 9px;
        max-width: 60px;
        height: 10px;
    }

    .totw-futgg-position-label {
        font-size: 7px;
        height: 8px;
    }

    .totw-futgg-player-score {
        font-size: 8px;
        height: 10px;
    }

    .totw-futgg-list-item {
        padding: 10px;
    }

    .totw-futgg-list-item-image {
        width: 45px;
        height: 45px;
    }

    .totw-futgg-list-item-name {
        font-size: 13px;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .totw-futgg-info-bar {
        padding: 10px 12px;
        min-height: 65px;
    }

    .totw-futgg-title {
        font-size: 16px;
    }

    .totw-futgg-meta {
        font-size: 11px;
    }

    .totw-futgg-pitch-column {
        padding: 16px 8px;
    }

    .totw-futgg-pitch-container {
        max-width: 380px;
    }

    .totw-futgg-players-column {
        min-height: 200px;
        padding: 12px;
    }

    /* Fixed card sizes for small mobile */
    .totw-futgg-player-card {
        width: 60px;
        height: 95px;
        padding: 4px;
        border-width: 1px;
    }

    .totw-futgg-player-image {
        width: 36px;
        height: 36px;
        border-width: 1px;
    }

    .totw-futgg-player-name {
        font-size: 8px;
        max-width: 52px;
        height: 9px;
    }

    .totw-futgg-position-label {
        font-size: 7px;
        height: 7px;
    }

    .totw-futgg-player-score {
        font-size: 7px;
        height: 9px;
    }

    .totw-futgg-list-header {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .totw-futgg-list-item {
        padding: 8px;
        gap: 10px;
    }

    .totw-futgg-list-item-image {
        width: 40px;
        height: 40px;
    }

    .totw-futgg-list-item-name {
        font-size: 12px;
    }

    .totw-futgg-list-item-position,
    .totw-futgg-list-item-team {
        font-size: 10px;
    }

    .totw-futgg-list-item-stats {
        font-size: 10px;
    }

    .totw-futgg-list-item-score {
        font-size: 12px;
    }
}
