/* css/escalacao.css - Premium Visual for Lineup Creator */

:root {
    --pitch-bg: #1a1a1a;
    --pitch-line: rgba(255, 255, 255, 0.1);
    --slot-bg: rgba(255, 255, 255, 0.05);
    --slot-border: rgba(255, 255, 255, 0.1);
    --accent-color: var(--primary-green, #00ff99);
    --accent-color-contrast: #07110c;
    --accent-color-glow: rgba(0, 255, 153, 0.28);
    --accent-color-glow-strong: rgba(0, 255, 153, 0.4);
    --accent-color-gradient-end: #4dffb8;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

#lineup-modal {
    overflow: hidden;
}

#lineup-modal .lineup-content {
    background-color: #121212;
    color: #e0e0e0;
    max-width: 1600px;
    width: 98vw;
    border-radius: 15px;
    border: 1px solid #333;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    max-height: 95vh;
    height: 95vh;
}

.lineup-header {
    padding: 10px;
    background: #1d1d1d;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.lineup-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #fff;
    white-space: nowrap;
}

.header-main-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 260px;
}

.team-overall-badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-gradient-end) 100%);
    color: var(--accent-color-contrast);
    padding: 10px 18px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.45);
    box-shadow: 0 10px 22px var(--accent-color-glow), 0 0 18px rgba(0, 0, 0, 0.35);
    min-width: 92px;
}

.team-overall-badge .avg-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
    opacity: 0.9;
    letter-spacing: 0.6px;
}

.team-overall-badge strong {
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}

.lineup-controls {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.lineup-formation-card {
    background: linear-gradient(145deg, #1a1a1a, #101010);
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
}

#lineup-formation {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 12px;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.lineup-actions-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.lineup-name-row {
    background: linear-gradient(145deg, #1a1a1a, #101010);
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 10px;
}

.lineup-name-input {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 12px;
    border-radius: 5px;
    outline: none;
    width: 260px;
}

.lineup-name-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 153, 0.15);
}

.lineup-action-btn {
    padding: 8px 16px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

#download-lineup-btn {
    background: #27ae60;
    color: white;
}

#download-lineup-btn:hover {
    background: #2ecc71;
    transform: translateY(-2px);
}

.lineup-submit-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-gradient-end) 100%);
    color: var(--accent-color-contrast);
    border: 1px solid rgba(0, 0, 0, 0.45);
}

.lineup-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 16px var(--accent-color-glow-strong);
}

.lineup-community-btn {
    background: linear-gradient(135deg, #1d5aff 0%, #0044ff 100%);
    color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.45);
}

.lineup-community-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 16px rgba(29, 90, 255, 0.45);
}

.lineup-clear-btn {
    background: #c0392b;
    color: white;
}

.lineup-clear-btn:hover {
    background: #e74c3c;
}

.lineup-send-message {
    padding: 10px 20px;
    border-bottom: 1px solid #222;
    font-weight: 600;
    font-size: 14px;
}

/* Pitch Styling */
.lineup-body {
    padding: 20px;
    display: flex;
    flex-direction: row;
    gap: 30px;
    background: #0f1011;
    overflow: visible;
    flex: 1;
    min-height: 0;
}

.lineup-left-sidebar {
    width: 170px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 0 1 170px;
    min-width: 150px;
}

.lineup-control-block {
    background: linear-gradient(145deg, #1a1a1a, #101010);
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

#lineup-formation {
    width: 100%;
}

.lineup-name-input {
    width: 100%;
}

.lineup-block-btn {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
    padding: 14px 12px;
    font-size: 14px;
}

.pitch-wrapper {
    flex: 1 1 520px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 500px;
    min-height: 0;
    min-width: 280px;
}

.pitch-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 100%;
    max-height: 800px;
    aspect-ratio: 3/4;
    background-image: url('../images/TDJ-background-v2.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* Starting XI Sidebar */
.starting-xi-sidebar {
    width: 350px;
    background: #1a1b1c;
    border: 1px solid #333;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-height: 0;
    flex: 0 1 350px;
    min-width: 280px;
}

.sidebar-header {
    background: linear-gradient(135deg, #222, #111);
    padding: 15px 20px;
    border-bottom: 2px solid var(--accent-color);
}

.sidebar-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.starting-xi-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.xi-item {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 8px 12px;
    gap: 15px;
}

.xi-number {
    width: 30px;
    height: 30px;
    background: #111;
    border: 2px solid #555;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.xi-item.filled .xi-number {
    background: var(--accent-color);
    border-color: var(--accent-color-gradient-end);
    color: var(--accent-color-contrast);
    box-shadow: 0 0 14px var(--accent-color-glow);
}

.xi-player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.xi-player-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.xi-player-pos {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
}

.xi-player-overall {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent-color);
}


.pitch-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.center-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--pitch-line);
}

.center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25%;
    aspect-ratio: 1;
    border: 2px solid var(--pitch-line);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.penalty-box {
    position: absolute;
    left: 50%;
    width: 50%;
    height: 15%;
    border: 2px solid var(--pitch-line);
    transform: translateX(-50%);
}

.penalty-box.top {
    top: 0;
    border-top: none;
}

.penalty-box.bottom {
    bottom: 0;
    border-bottom: none;
}

/* Player Slots */
.pitch-players {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.lineup-player-slot {
    position: absolute;
    width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.lineup-player-slot:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.slot-visual {
    width: 80px;
    height: 80px;
    background: var(--slot-bg);
    border: 2px dashed var(--slot-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
}

.slot-visual i.icon-plus {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.3);
}

.slot-player-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: none;
    border: 3px solid var(--accent-color);
    background: #222;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.slot-overall-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--accent-color);
    color: var(--accent-color-contrast);
    font-size: 13px;
    font-weight: 800;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
    border: 2px solid #111;
    z-index: 3;
    box-shadow: 0 0 14px var(--accent-color-glow-strong);
}

.slot-player-name {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 10px;
    border-radius: 6px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Slot states */
.lineup-player-slot.filled .slot-visual {
    border-style: solid;
    border-color: #fff;
}

.lineup-player-slot.filled .slot-player-img,
.lineup-player-slot.filled .slot-overall-badge {
    display: flex;
}

.lineup-player-slot.filled .slot-visual i.icon-plus {
    display: none;
}

/* Player Selector Modal (Sub-modal) */
.sub-modal {
    z-index: 2000;
    /* Above regular modals */
    background: rgba(0, 0, 0, 0.85);
}

.player-selector-content {
    background: #1e1e1e;
    width: 550px;
    max-height: 80vh;
    border-radius: 12px;
    padding: 25px;
    position: relative;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.player-selector-search input {
    width: 100%;
    padding: 12px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    margin: 15px 0;
}

.player-selector-list {
    flex: 1;
    overflow-y: auto;
}

.selector-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 6px;
}

.selector-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.selector-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.selector-item .player-info {
    flex: 1;
}

.selector-item .player-nick {
    font-weight: 600;
    color: #fff;
    display: block;
}

.selector-item .player-meta {
    font-size: 11px;
    color: #888;
}

.selector-item .player-overall {
    background: var(--accent-color);
    color: var(--accent-color-contrast);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
}

/* Icon Placeholders (if not available) */
.icon-camera::before {
    content: "📸";
}

.icon-send::before {
    content: "📨";
}

.icon-plus::before {
    content: "+";
}

@media (max-width: 900px) {
    #lineup-modal {
        overflow: hidden;
        align-items: center;
        justify-content: center;
    }

    #lineup-modal .lineup-content {
        height: 95vh;
        max-height: 95vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .lineup-header {
        padding: 14px;
    }

    .lineup-body {
        flex-direction: column;
        padding: 14px;
        gap: 14px;
        overflow: visible;
        flex: none;
        min-height: auto;
    }
    
    .starting-xi-sidebar {
        width: 100%;
        max-height: 44vh;
        overflow: hidden;
        flex: none;
    }
    
    .pitch-wrapper {
        min-height: auto;
    }

    .lineup-left-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .lineup-control-block,
    .lineup-block-btn {
        flex: 1 1 180px;
    }

    .pitch-container {
        max-width: 100%;
        max-height: 52vh;
    }

    .starting-xi-list {
        padding: 12px;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 1200px) {
    .lineup-body {
        flex-direction: column;
    }

    .lineup-left-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        flex: none;
    }

    .lineup-control-block,
    .lineup-block-btn {
        flex: 1 1 180px;
    }

    .pitch-container {
        max-width: 100%;
        max-height: 60vh;
    }

    .starting-xi-sidebar {
        width: 100%;
        flex: none;
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .lineup-header h2 {
        font-size: 1.15rem;
    }

    .team-overall-badge {
        min-width: 78px;
        padding: 8px 14px;
    }

    .team-overall-badge strong {
        font-size: 26px;
    }

    .lineup-body {
        padding: 12px;
        gap: 12px;
    }

    .lineup-left-sidebar {
        gap: 10px;
    }

    .lineup-control-block {
        min-height: 56px;
        padding: 8px;
    }

    .lineup-block-btn {
        min-height: 56px;
        padding: 12px 10px;
        font-size: 13px;
    }

    .starting-xi-sidebar {
        max-height: 44vh;
        overflow: hidden;
    }

    .lineup-player-slot {
        width: 60px;
    }

    .slot-visual {
        width: 45px;
        height: 45px;
    }

    .slot-player-name {
        font-size: 9px;
    }
}

@media (max-width: 420px) {
    .lineup-header h2 {
        font-size: 1.05rem;
    }

    .pitch-container {
        max-height: 46vh;
    }
}
