/* ============================================================
   2V2 TEAM BUILDER — supplemental styles
   Builds on top of the companion app's style.css
   ============================================================ */

/* ---- Page Header ---- */
.team-page-header {
    text-align: center;
    margin-bottom: 24px;
    animation: fadeIn 0.7s ease;
}
.team-page-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.4rem, 4vw, 2.4rem);
    font-weight: 900;
    letter-spacing: 6px;
    color: #ffb429;
    text-shadow: 0 0 20px rgba(255, 180, 41, 0.5), 0 0 40px rgba(255, 180, 41, 0.2);
    margin-bottom: 6px;
}
.team-page-sub {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
}

/* ---- Team Name Input ---- */
.team-name-row {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
    animation: fadeIn 0.8s ease;
}
.team-name-input {
    background: transparent;
    border: none;
    border-bottom: 3px solid rgba(255, 180, 41, 0.5);
    color: #ffb429;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 3vw, 1.9rem);
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    text-align: center;
    padding: 6px 16px;
    outline: none;
    width: clamp(200px, 50%, 480px);
    transition: border-color 0.2s, text-shadow 0.2s;
}
.team-name-input::placeholder {
    color: rgba(255, 180, 41, 0.25);
    letter-spacing: 6px;
}
.team-name-input:focus {
    border-bottom-color: #ffb429;
    text-shadow: 0 0 20px rgba(255, 180, 41, 0.45);
}

/* ---- Three-column Arena ---- */
.team-arena {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    width: 96%;
    max-width: 1500px;
    align-items: start;
    margin: 0 auto 60px;
}

/* ---- Player Panel ---- */
.player-panel {
    background: rgba(10, 6, 30, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.18);
    border-radius: 12px;
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(6px);
    transition: border-color 0.3s;
    min-width: 0;
}
.player-panel--left {
    border-color: rgba(0, 240, 255, 0.25);
    box-shadow: -4px 0 30px rgba(0, 240, 255, 0.07);
}
.player-panel--right {
    border-color: rgba(255, 0, 200, 0.25);
    box-shadow: 4px 0 30px rgba(255, 0, 200, 0.07);
}
.player-panel--left:has(.team-grid .weapon-slot.tap-target) {
    border-color: rgba(255, 180, 41, 0.6);
    box-shadow: 0 0 24px rgba(255, 180, 41, 0.25);
}
.player-panel--right:has(.team-grid .weapon-slot.tap-target) {
    border-color: rgba(255, 180, 41, 0.6);
    box-shadow: 0 0 24px rgba(255, 180, 41, 0.25);
}

/* ---- Panel Header ---- */
.player-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}
.player-name-input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 180, 41, 0.4);
    color: #ffb429;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 4px 2px;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}
.player-name-input:focus {
    border-bottom-color: #ffb429;
    text-shadow: 0 0 10px rgba(255, 180, 41, 0.4);
}
.player-panel--right .player-name-input {
    text-align: right;
}
.player-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.tag-left {
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid rgba(0, 240, 255, 0.5);
    color: #00f0ff;
}
.tag-right {
    background: rgba(255, 0, 200, 0.15);
    border: 1px solid rgba(255, 0, 200, 0.5);
    color: #ff00c8;
}

/* ---- Team Grid (5 weapon slots) ---- */
.team-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 0;
    animation: none;
}
/* Override per-child animation delays from shared style */
.team-grid .weapon-slot { animation: slideIn 0.5s ease forwards; }
.team-grid .weapon-slot:nth-child(1)  { animation-delay: 0.03s; }
.team-grid .weapon-slot:nth-child(2)  { animation-delay: 0.06s; }
.team-grid .weapon-slot:nth-child(3)  { animation-delay: 0.09s; }
.team-grid .weapon-slot:nth-child(4)  { animation-delay: 0.12s; }
.team-grid .weapon-slot:nth-child(5)  { animation-delay: 0.15s; }
.team-grid .weapon-slot:nth-child(6)  { animation-delay: 0.18s; }
.team-grid .weapon-slot:nth-child(7)  { animation-delay: 0.21s; }
.team-grid .weapon-slot:nth-child(8)  { animation-delay: 0.24s; }
.team-grid .weapon-slot:nth-child(9)  { animation-delay: 0.27s; }
.team-grid .weapon-slot:nth-child(10) { animation-delay: 0.30s; }
.team-grid .weapon-slot:nth-child(11) { animation-delay: 0.33s; }
.team-grid .weapon-slot:nth-child(12) { animation-delay: 0.36s; }
.team-grid .weapon-slot:nth-child(13) { animation-delay: 0.39s; }
.team-grid .weapon-slot:nth-child(14) { animation-delay: 0.42s; }
.team-grid .weapon-slot:nth-child(15) { animation-delay: 0.45s; }

/* Empty slot visual */
.weapon-slot.empty-slot {
    opacity: 0.35;
    border-style: dashed;
}
.weapon-slot.empty-slot .weapon-name { color: #555; }

/* ---- Panel Footer buttons ---- */
.panel-footer {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.panel-btn {
    flex: 1;
    padding: 7px 8px !important;
    font-size: 0.6rem !important;
    min-height: 30px !important;
    letter-spacing: 1px !important;
}

/* ---- Shared Tool Library ---- */
.team-library {
    width: clamp(220px, 28vw, 360px);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 20px;
}

.lib-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 180, 41, 0.3);
}
.lib-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffb429;
}
.lib-hint {
    font-size: 0.6rem;
    color: #777;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}
.lib-hint.armed-mode {
    color: #ffb429;
    animation: pulse-hint 0.8s ease infinite alternate;
}
@keyframes pulse-hint {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

/* Tool grid inside library */
.team-tool-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}
.team-tool-list .tool-item img {
    width: 44px;
    height: 44px;
}
/* Dual-use indicator: tool used in A or B or both */
.tool-item .use-dots {
    display: flex;
    gap: 3px;
    justify-content: center;
    min-height: 6px;
    margin-top: 2px;
}
.use-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.use-dot.dot-A { background: #00f0ff; box-shadow: 0 0 4px #00f0ff; }
.use-dot.dot-B { background: #ff00c8; box-shadow: 0 0 4px #ff00c8; }

/* Tool armed for a specific side */
.tool-item.armed-A { 
    border-color: #00f0ff !important; 
    background: rgba(0, 240, 255, 0.2) !important; 
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.5); 
}
.tool-item.armed-B { 
    border-color: #ff00c8 !important; 
    background: rgba(255, 0, 200, 0.2) !important; 
    box-shadow: 0 0 12px rgba(255, 0, 200, 0.5); 
}

/* Global buttons inside library */
.lib-global-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.lib-global-btn {
    width: 100%;
    font-size: 0.65rem !important;
    padding: 8px 10px !important;
    min-height: 32px !important;
    letter-spacing: 1.5px !important;
}
.save-team-btn::before { background: #ffe0a0 !important; }
.save-team-btn:hover::before { background: #ffb429 !important; }
.save-team-btn { filter: drop-shadow(0 0 6px rgba(255,180,41,0.3)); }

/* ---- Armed Toast ---- */
.armed-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 6, 30, 0.95);
    border: 1px solid #ffb429;
    border-radius: 50px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    color: #ffb429;
    box-shadow: 0 0 30px rgba(255, 180, 41, 0.4);
    animation: slideUp 0.3s ease;
    z-index: 500;
    white-space: nowrap;
}
.armed-toast.hidden { display: none; }
.armed-toast-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}
.armed-toast-name { font-weight: 700; text-transform: uppercase; }
.armed-toast-hint { color: rgba(255,255,255,0.4); font-size: 0.6rem; }

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---- Panel tab bar (mobile only, hidden on desktop) ---- */
.panel-tabs {
    display: none;
}

/* ---- Responsive: horizontal swipe panels on mobile ---- */
@media (max-width: 1100px) {
    /* Make arena a full-width horizontal scroll snap container */
    .team-arena {
        display: flex;
        flex-direction: row;
        overflow-x: scroll;
        overflow-y: visible;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0;
        width: 100vw;
        max-width: 100vw;
        margin-left: 0;
        margin-right: 0;
        padding: 0;
        align-items: flex-start;
        margin-bottom: 0;
    }
    .team-arena::-webkit-scrollbar { display: none; }

    /* Each panel is one full-screen swipe page */
    .player-panel--left,
    .player-panel--right,
    .team-library {
        flex: 0 0 100vw;
        width: 100vw;
        max-width: 100vw;
        box-sizing: border-box;
        scroll-snap-align: start;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 16px 14px 80px; /* bottom pad clears the tab bar */
        margin: 0;
        min-height: calc(100vh - 200px);
    }

    /* Library: natural order (P1 → Library → P2 left to right) */
    .team-library {
        position: static;
        order: 0;
        border: none;
        /* Prevent horizontal swipes on the tool library from triggering
           the arena's scroll-snap — use tab bar to navigate instead */
        touch-action: pan-y;
        overflow-y: auto;
    }

    .team-tool-list { grid-template-columns: repeat(5, 1fr); }
    .team-tool-list .tool-item img { width: 44px; height: 44px; }

    /* Sticky tab bar at bottom */
    .panel-tabs {
        display: flex;
        justify-content: center;
        gap: 8px;
        padding: 10px 16px 14px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(6, 3, 20, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 180, 41, 0.2);
        z-index: 200;
    }
    .panel-tab {
        font-family: 'Orbitron', sans-serif;
        font-size: 0.6rem;
        font-weight: 700;
        letter-spacing: 2px;
        padding: 9px 0;
        flex: 1;
        max-width: 120px;
        border-radius: 6px;
        border: 1px solid rgba(255,255,255,0.12);
        background: transparent;
        color: rgba(255, 255, 255, 0.35);
        cursor: pointer;
        transition: background 0.2s, border-color 0.2s, color 0.2s;
    }
    .panel-tab[data-panel="0"].active {
        background: rgba(0, 240, 255, 0.12);
        border-color: rgba(0, 240, 255, 0.6);
        color: #00f0ff;
    }
    .panel-tab[data-panel="1"].active {
        background: rgba(255, 180, 41, 0.12);
        border-color: rgba(255, 180, 41, 0.6);
        color: #ffb429;
    }
    .panel-tab[data-panel="2"].active {
        background: rgba(255, 0, 200, 0.12);
        border-color: rgba(255, 0, 200, 0.6);
        color: #ff00c8;
    }

    /* Push armed toast above the tab bar */
    .armed-toast { bottom: 80px; }

    /* When a tool is armed, P1 and P2 tabs pulse to invite a tap */
    .panel-tabs.armed-mode .panel-tab[data-panel="0"] {
        background: rgba(0, 240, 255, 0.18);
        border-color: #00f0ff;
        color: #00f0ff;
        animation: pulse-player-tab 0.75s ease-in-out infinite alternate;
    }
    .panel-tabs.armed-mode .panel-tab[data-panel="2"] {
        background: rgba(255, 0, 200, 0.18);
        border-color: #ff00c8;
        color: #ff00c8;
        animation: pulse-player-tab 0.75s ease-in-out infinite alternate;
    }
    @keyframes pulse-player-tab {
        from { opacity: 0.55; box-shadow: none; }
        to   { opacity: 1;    box-shadow: 0 0 14px rgba(255,255,255,0.25); }
    }
}

@media (max-width: 600px) {
    .team-page-title { font-size: 1.3rem; letter-spacing: 3px; }
}
