/* =========================================
   MODULE 5: COMMAND CENTER (FINAL FIX)
   ========================================= */

#positions-details {
    overflow: visible !important;
    display: block !important;
    padding-bottom: 80px;
}

/* 1. Main UI Container */
.command-center-ui {
    /* Розміри */
    width: 100%; 
    max-width: 100%; 
    min-height: 600px;
    
    /* Відступи */
    margin: 0 auto;
    
    /* Стиль */
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.6);
    
    /* Структура */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 5;
    font-family: 'Montserrat', sans-serif;
}


/* --- TOOLBAR --- */
.cc-toolbar {
    height: 80px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    flex-shrink: 0;
}

.toolbar-left, .toolbar-right, .toolbar-center { display: flex; align-items: center; gap: 20px; }
.fake-select-group { display: flex; flex-direction: column; gap: 4px; }
.fake-select-group label { font-size: 0.65rem; color: #64748b; text-transform: uppercase; font-weight: 700; }

.fake-select {
    background: #1e293b; color: #fff; border: 1px solid #334155; border-radius: 4px; 
    padding: 6px 12px; font-size: 0.85rem; min-width: 140px; 
    display: flex; justify-content: space-between; align-items: center;
    cursor: default; pointer-events: none;
}
.arrow { font-size: 0.6rem; color: #64748b; }

.action-buttons { display: flex; gap: 10px; }
.btn-secondary {
    background: transparent; border: 1px solid #475569; color: #cbd5e1;
    padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; cursor: pointer;
    display: flex; align-items: center; gap: 6px; transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.05); color: #fff; border-color: #94a3b8; }
.btn-secondary .icon { font-size: 0.9rem; }

.team-rating {
    background: #0b1120; padding: 6px 16px; border-radius: 20px; border: 1px solid #334155;
    display: flex; align-items: center; gap: 10px;
}
.ovr-label { font-size: 0.75rem; color: #94a3b8; font-weight: 700; letter-spacing: 0.5px; } 
.ovr-value { font-size: 1.3rem; color: #22c55e; font-weight: 800; line-height: 1; }

.btn-abench-rec {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none; color: white;
    padding: 12px 20px; border-radius: 8px;
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 0.9rem; cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.pulse-btn { animation: pulse-blue 2s infinite; }
@keyframes pulse-blue { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); } 50% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }


/* --- WORKSPACE --- */
.cc-workspace {
    display: flex;
    flex: 1; min-height: 550px; width: 100%;
}

/* LEFT: PITCH */
.cc-pitch-area {
    flex: 3.5;
    background: #0b1120;
    position: relative;
    padding: 20px;
    display: flex; align-items: center; justify-content: center;
    border-right: 1px solid #334155;
}

.pitch-surface {
    width: 100%; height: 100%;
    background: #14532d;
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 50px, transparent 50px, transparent 100px);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    position: relative;
}
.pitch-line.mid { position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: rgba(255,255,255,0.4); }
.pitch-circle { position: absolute; top: 50%; left: 50%; width: 120px; height: 120px; border: 1px solid rgba(255,255,255,0.4); border-radius: 50%; transform: translate(-50%, -50%); }
.pitch-box { position: absolute; left: 30%; right: 30%; height: 60px; border: 1px solid rgba(255,255,255,0.4); }
.box-top { top: 0; border-top: none; } .box-bottom { bottom: 0; border-bottom: none; }

/* Players */
.t-node { position: absolute; transform: translate(-50%, 50%); z-index: 10; }
.t-card { 
    background: rgba(15, 23, 42, 0.9); border: 1px solid #475569; 
    padding: 4px 10px; border-radius: 4px; 
    display: flex; align-items: center; gap: 6px; 
    white-space: nowrap; box-shadow: 0 4px 6px rgba(0,0,0,0.5); 
}
.t-node.gk .t-card { border-color: #eab308; }
.num { background: #334155; color: #fff; font-size: 0.75rem; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.t-node.gk .num { background: #eab308; color: #000; }
.name { font-size: 0.8rem; color: #fff; font-weight: 600; text-transform: uppercase; }

/* Empty Slot */
.t-node.empty .t-card.dashed { background: rgba(255,255,255,0.1); border: 1px dashed rgba(255,255,255,0.6); }
.plus { font-size: 1.1rem; color: #fff; }


/* --- POPUP FIX: MOVED TO RIGHT --- */
.abench-rec-plaque {
    position: absolute; 
    top: 50%; /* Центр по висоті ноди */
    left: 55px; /* Зсув праворуч від ноди */
    transform: translateY(-50%);
    
    background: #1e293b; 
    border: 1px solid #3b82f6; 
    border-radius: 8px; 
    overflow: visible; /* Щоб стрілка не обрізалась */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); 
    min-width: 160px;
    z-index: 50;
    
    /* Анімація */
    animation: floatHorizontal 3s infinite ease-in-out;
}

.rec-header {
    background: #3b82f6; color: #fff; font-size: 0.65rem; font-weight: 700; 
    padding: 4px 8px; text-transform: uppercase; display: flex; align-items: center; gap: 5px;
    border-radius: 6px 6px 0 0;
}
.rec-body { padding: 8px; display: flex; flex-direction: column; align-items: center; }
.rec-name { font-size: 0.9rem; font-weight: 800; color: #fff; }
.rec-match { font-size: 0.75rem; color: #3b82f6; font-weight: 700; }

/* Стрілка вліво */
.rec-arrow {
    position: absolute; 
    top: 50%; 
    left: -6px; /* Вихід за ліву межу */
    margin-top: -5px; 
    width: 10px; height: 10px; 
    background: #1e293b; 
    border-bottom: 1px solid #3b82f6; 
    border-left: 1px solid #3b82f6; 
    transform: rotate(45deg);
}

@keyframes floatHorizontal {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(5px); }
}


/* SIDEBAR */
.cc-sidebar {
    flex: 1; min-width: 260px;
    background: #0f172a; border-left: 1px solid #334155;
    display: flex; flex-direction: column;
}
.sidebar-header { 
    padding: 15px 20px; border-bottom: 1px solid #1e293b; 
    color: #94a3b8; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; 
}

.roster-grid { padding: 15px; overflow-y: auto; flex: 1; }

.r-card { 
    display: flex; justify-content: space-between; align-items: center; 
    background: rgba(255,255,255,0.03); padding: 10px; border-radius: 6px; 
    margin-bottom: 8px; border: 1px solid transparent; 
}
.r-card.recommended { 
    background: rgba(59, 130, 246, 0.1); border-color: #3b82f6; 
    box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.1);
}
.r-left { display: flex; align-items: center; gap: 10px; }
.r-avatar { width: 32px; height: 32px; background: #334155; border-radius: 50%; color: #fff; font-size: 0.7rem; display: flex; align-items: center; justify-content: center; border: 1px solid #475569; }
.r-name { font-size: 0.8rem; color: #fff; font-weight: 600; } 
.r-pos { font-size: 0.65rem; color: #94a3b8; }
.ai-badge { background: #3b82f6; color: #fff; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.r-ovr { font-size: 0.9rem; font-weight: 800; color: #fff; }
.status { font-size: 1rem; }
.r-card.disabled { opacity: 0.5; filter: grayscale(1); }

/* Responsive */
@media (max-width: 900px) {
    .cc-workspace { flex-direction: column; height: auto; }
    .cc-pitch-area { height: 400px; width: 100%; }
    .cc-sidebar { height: 350px; width: 100%; }
    .cc-toolbar { flex-direction: column; height: auto; padding: 15px; gap: 15px; }
    .toolbar-left, .toolbar-center, .toolbar-right { width: 100%; justify-content: center; }
    .fake-select { min-width: 100%; }
    
    /* На мобільному плашку можна сховати або перемістити */
    .abench-rec-plaque { display: none; }
}