/* style.css */
:root {
    --vh: 1vh;
}

body {
    margin: 0;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: row;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#logoBanner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: #222;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    z-index: 1000;
}

#gameTitle {
    flex: 1;
    text-align: left;
    padding-left: 10px;
}

#teamSelector {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #555;
}

#teamSelector label {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    color: #00ff88;
}

#teamSelect {
    background: #222;
    color: white;
    border: 2px solid #00ff88;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    min-width: 200px;
    max-width: 250px;
}

#teamSelect:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
}

#mobileRosterButtons {
    display: none;
    position: absolute;
    right: 10px;
    gap: 8px;
}

#mobileRosterButtons button {
    padding: 6px 12px;
    background: linear-gradient(135deg, #333, #555);
    color: white;
    border: 2px solid #666;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#mobileRosterButtons button:hover,
#mobileRosterButtons button.active {
    background: linear-gradient(135deg, #0066cc, #004499);
    border-color: #0088ff;
    transform: translateY(-1px);
}

#fullscreenBtn {
    margin-left: 8px !important;
    background: linear-gradient(135deg, #444, #666) !important;
    font-size: 14px !important;
}

#fullscreenBtn:hover {
    background: linear-gradient(135deg, #666, #888) !important;
}

/* Additional desktop responsiveness */
@media (max-width: 1200px) and (min-width: 1025px) {
    #leftPanel,
    #rightPanel {
        width: 160px;
    }
    
    #gameContainer {
        left: 160px;
        right: 160px;
    }
}

#leftPanel,
#rightPanel {
    position: absolute;
    top: 60px;
    width: 180px;
    height: calc(100% - 60px);
    background: #1b1b1b;
    color: white;
    overflow-y: auto;
    z-index: 500;
}

#leftPanel {
    left: 0;
}

#rightPanel {
    right: 0;
}

#leftPanel h3,
#rightPanel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    text-align: center;
    padding: 8px;
    border-radius: 5px;
    background: linear-gradient(90deg, #0066cc, #004499);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#leftPanel table,
#rightPanel table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

#leftPanel thead,
#rightPanel thead {
    background: linear-gradient(90deg, #333, #555);
}

#leftPanel th,
#rightPanel th {
    padding: 8px 4px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    border-bottom: 2px solid #555;
}

#leftPanel td,
#rightPanel td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 4px;
    text-align: center;
    font-size: 11px;
}

#leftPanel tr:nth-child(even),
#rightPanel tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

#leftPanel tr:hover,
#rightPanel tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

#gameContainer {
    position: absolute;
    top: 60px;
    left: 180px;
    right: 180px;
    bottom: 0;
    background-color: #000;
    z-index: 0;
    overflow: hidden;
    min-width: 400px;
}

canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
    border-radius: 8px;
}

/* Mobile canvas should fill completely */
@media (max-width: 700px) {
    canvas {
        object-fit: cover;
        border-radius: 0;
    }
}

#mobileControls {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 40, 0.9));
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    #mobileRosterToggle {
        display: flex;
    }
}

#mobileRosterToggle {
    display: none;
}

#selectionInfo {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(100, 100, 0, 0.8), rgba(150, 150, 0, 0.8));
    padding: 8px 12px;
    border-radius: 5px;
    color: white;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    font-weight: bold;
    display: none;
}

.team-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.team-header h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    text-align: center;
    line-height: 1.2;
    transition: all 0.3s ease;
}

.team-header.player-controlled h3 {
    color: #00ff88;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
    font-weight: bold;
}

.team-header.opponent h3 {
    color: #ff6666;
    opacity: 0.7;
}

.fantasy-score {
    font-size: 13px;
    color: #ffcc00;
    font-weight: bold;
    margin-bottom: 4px;
}

.season-stats {
    font-size: 12px;
    color: #88ccff;
    margin-bottom: 4px;
    font-weight: 500;
}

.team-score {
    font-size: 12px;
    font-weight: bold;
    color: #00ff88;
}

.health-bar {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ff8844, #44ff44);
    transition: width 0.3s ease;
}

/* Tablet and smaller desktop screens */
@media (max-width: 1024px) {
    #leftPanel,
    #rightPanel {
        width: 150px;
    }
    
    #gameContainer {
        left: 150px;
        right: 150px;
    }
}

/* Mobile styles */
@media (max-width: 700px) {
    body {
        flex-direction: column;
        padding-top: 40px;
        overflow-x: hidden;
        overflow-y: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    #logoBanner {
        height: 40px;
        font-size: 1.2rem;
    }
    
    #mobileRosterButtons {
        display: flex;
    }
    
    #gameTitle {
        font-size: 1.1rem;
    }

    /* Hide panels by default on mobile - popup style */
    #leftPanel,
    #rightPanel {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0) !important;
        width: 85% !important;
        max-width: 350px !important;
        height: auto !important;
        max-height: 60vh !important;
        z-index: 1000;
        font-size: 11px;
        padding: 12px;
        transition: transform 0.3s ease;
        background: rgba(27, 27, 27, 0.96);
        backdrop-filter: blur(15px);
        border: 2px solid #555;
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
        display: block !important;
        overflow-y: auto;
    }

    #leftPanel.show,
    #rightPanel.show {
        transform: translate(-50%, -50%) scale(1) !important;
    }

    #leftPanel h3,
    #rightPanel h3 {
        font-size: 14px;
        padding: 6px;
        margin-bottom: 8px;
        position: relative;
    }
    
    /* Close button for mobile popups */
    .panel-close {
        position: absolute;
        top: 8px;
        right: 12px;
        background: #ff4444;
        color: white;
        border: none;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        font-size: 14px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1001;
    }

    #leftPanel th,
    #rightPanel th,
    #leftPanel td,
    #rightPanel td {
        padding: 3px 2px;
        font-size: 10px;
    }

    /* Full screen game container */
    #gameContainer {
        position: fixed;
        top: 40px;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        height: calc(100vh - 40px);
        display: flex;
        justify-content: center;
        align-items: center;
    }


    #mobileControls {
        display: block;
        top: 10px;
        left: 10px;
        padding: 6px;
        font-size: 10px;
    }

    #selectionInfo {
        bottom: 10px;
        left: 10px;
        padding: 4px 6px;
        font-size: 9px;
    }
}

/* Mobile portrait - smaller screens */
@media (max-width: 480px) {
    body {
        padding-top: 40px;
    }

    #logoBanner {
        height: 40px;
        line-height: 40px;
        font-size: 1.1rem;
    }

    #gameContainer {
        top: 40px;
        height: calc(100vh - 40px);
    }

    #leftPanel,
    #rightPanel {
        height: 50vh;
        padding: 8px;
    }

    #leftPanel h3,
    #rightPanel h3 {
        font-size: 12px;
        padding: 4px;
    }

    #leftPanel th,
    #rightPanel th,
    #leftPanel td,
    #rightPanel td {
        padding: 2px 1px;
        font-size: 8px;
    }

    #mobileRosterToggle button {
        padding: 10px 16px;
        font-size: 12px;
    }

    #mobileControls {
        font-size: 9px;
        padding: 4px;
        top: 5px;
        left: 5px;
    }

    #selectionInfo {
        bottom: 70px;
        left: 5px;
        padding: 3px 5px;
        font-size: 8px;
    }
}

/* Mobile landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    #mobileRosterButtons {
        right: 5px;
        gap: 5px;
    }

    #mobileRosterButtons button {
        padding: 4px 8px;
        font-size: 10px;
    }

    #leftPanel,
    #rightPanel {
        width: 70%;
        max-width: 400px;
        height: auto;
        max-height: 50vh;
    }

    #leftPanel.show,
    #rightPanel.show {
        transform: translate(-50%, -50%) scale(1) !important;
    }

    #selectionInfo {
        bottom: 10px;
        right: 10px;
        left: auto;
    }

    #mobileControls {
        top: 10px;
        right: 10px;
        left: auto;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    #leftPanel,
    #rightPanel {
        height: 45vh;
        padding: 6px;
    }

    #leftPanel h3,
    #rightPanel h3 {
        font-size: 11px;
        padding: 3px;
    }

    #leftPanel th,
    #rightPanel th,
    #leftPanel td,
    #rightPanel td {
        padding: 1px;
        font-size: 7px;
    }

    #mobileRosterToggle button {
        padding: 8px 12px;
        font-size: 11px;
    }
}