/* style.css - Robo-Soccer 3D styling */

:root {
    --primary-blue: #3b82f6;
    --primary-red: #ef4444;
    --bg-dark: #0a0f1d;
    --bg-overlay: rgba(10, 15, 29, 0.85);
    --panel-bg: rgba(30, 41, 59, 0.7);
    --border-light: rgba(255, 255, 255, 0.08);
    --border-active: rgba(255, 255, 255, 0.2);
    --text-white: #f8fafc;
    --text-gray: #94a3b8;
    --glow-blue: 0 0 15px rgba(59, 130, 246, 0.6);
    --glow-red: 0 0 15px rgba(239, 68, 68, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Outfit', sans-serif;
    color: var(--text-white);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* HUD Header styling */
.hud-header {
    position: absolute;
    top: 15px;
    left: 5%;
    right: 5%;
    height: 60px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.hud-item {
    pointer-events: auto;
}

/* Back Link Button */
.back-link {
    background: var(--panel-bg);
    border: 1px solid var(--border-light);
    color: var(--text-white);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(12px);
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.back-link:hover {
    border-color: var(--border-active);
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-2px);
}

/* Scoreboard */
.hud-scoreboard {
    background: var(--panel-bg);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    padding: 5px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.team-badge {
    font-size: 0.9rem;
    font-weight: 900;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.team-blue {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: var(--glow-blue);
}

.team-red {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: var(--glow-red);
}

.score-display {
    font-size: 2rem;
    font-weight: 900;
    font-family: 'Quicksand', sans-serif;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-display .colon {
    color: var(--text-gray);
    animation: pulse 1s infinite alternate;
}

/* Timer */
.hud-timer {
    background: var(--panel-bg);
    border: 1px solid var(--border-light);
    color: var(--text-white);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.hud-btn {
    background: var(--panel-bg);
    border: 1px solid var(--border-light);
    color: var(--text-white);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    backdrop-filter: blur(12px);
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.hud-btn:hover {
    border-color: var(--border-active);
    transform: scale(1.05);
}

.hud-btn.sound-off {
    color: var(--primary-red);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Screens overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-overlay);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    padding: 20px;
}

.overlay-screen.active {
    display: flex;
}

.screen-content {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-subtitle {
    color: var(--primary-blue);
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.game-title {
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.game-title span {
    color: var(--primary-blue);
    position: relative;
}

.game-description {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* Mode buttons */
.mode-selection {
    margin-bottom: 25px;
}

.mode-selection h3 {
    font-size: 0.8rem;
    color: var(--text-gray);
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-align: left;
}

.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-mode {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-gray);
    padding: 15px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-mode:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-white);
}

.btn-mode.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-blue);
    color: var(--text-white);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* Team selection styles */
.team-selection {
    margin-bottom: 25px;
}

.team-selection h3 {
    font-size: 0.8rem;
    color: var(--text-gray);
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-align: left;
}

.team-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-team {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-gray);
    padding: 15px;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 1px;
}

.btn-team:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-white);
}

.btn-boca.active {
    background: rgba(29, 78, 216, 0.25);
    border-color: #f59e0b;
    color: #f8fafc;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.btn-river.active {
    background: rgba(248, 250, 252, 0.1);
    border-color: #dc2626;
    color: #f8fafc;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.35);
    text-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

.shield-icon {
    font-size: 1.1rem;
}

/* Custom scoreboard team badges */
.team-badge.boca-theme {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%) !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4) !important;
    color: #f59e0b !important;
}

.team-badge.river-theme {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    border: 2px solid #dc2626 !important;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.4) !important;
    color: #dc2626 !important;
}

/* Control Layout Guidelines */
.how-to-play {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
}

.how-to-play h3 {
    font-size: 0.8rem;
    color: var(--text-gray);
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-align: left;
}

.controls-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    text-align: left;
}

.control-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
}

.control-col strong {
    font-size: 0.85rem;
    margin-bottom: 5px;
    display: block;
}

.control-col:nth-child(1) strong {
    color: var(--primary-blue);
}

.control-col:nth-child(2) strong {
    color: var(--primary-red);
}

.control-col span {
    color: var(--text-gray);
}

.control-col span strong {
    display: inline;
    color: var(--text-white) !important;
}

.mobile-note {
    margin-top: 15px;
    font-size: 0.8rem;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

/* Play button */
.btn-play-game {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    color: white;
    padding: 16px 36px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.4);
}

.btn-play-game:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(29, 78, 216, 0.5);
    filter: brightness(1.1);
}

.btn-play-game:active {
    transform: translateY(-1px);
}

.btn-secondary-game {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-light);
    color: var(--text-white);
    box-shadow: none;
}

.btn-secondary-game:hover {
    background: rgba(30, 41, 59, 1);
    border-color: var(--border-active);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Goal Overlay Announcement */
.goal-announcement {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 90;
    background: rgba(10, 15, 29, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.goal-announcement.active {
    display: flex;
}

.goal-text-wrapper {
    text-align: center;
    animation: goalTextBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.goal-title {
    font-size: 8rem;
    font-weight: 900;
    font-family: 'Outfit', sans-serif;
    color: #f59e0b;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.6), 0 0 40px rgba(245, 158, 11, 0.4);
    letter-spacing: -2px;
    text-transform: uppercase;
    animation: textGlowPulse 0.5s infinite alternate;
}

.goal-subtitle {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    margin-top: -10px;
    letter-spacing: 1px;
}

/* Victory Screen custom */
.victory-icon {
    font-size: 4.5rem;
    color: #ffd700;
    margin-bottom: 20px;
    animation: float 2s infinite ease-in-out;
}

.screen-title-win {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.score-report {
    color: var(--text-gray);
    font-size: 1rem;
    margin-bottom: 10px;
}

.final-score {
    font-size: 3rem;
    font-weight: 900;
    font-family: 'Quicksand', sans-serif;
    color: #10b981;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

.screen-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Touch overlay */
#touch-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px;
    z-index: 50;
    pointer-events: none;
    display: none; /* Shown dynamically in mobile */
    justify-content: space-between;
    padding: 0 40px 40px 40px;
    align-items: flex-end;
}

#joystick-container {
    pointer-events: auto;
    width: 110px;
    height: 110px;
}

#joystick-base {
    width: 100%;
    height: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    position: relative;
    touch-action: none;
    backdrop-filter: blur(8px);
}

#joystick-handle {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), var(--glow-blue);
    transition: transform 0.05s ease;
}

#action-container {
    pointer-events: auto;
}

.action-btn {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 15px rgba(185, 28, 28, 0.4), var(--glow-red);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    touch-action: none;
    backdrop-filter: blur(8px);
    transition: transform 0.1s ease;
}

.action-btn:active {
    transform: scale(0.9);
}

/* Animations */
@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

@keyframes goalTextBounce {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.15); }
    80% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes textGlowPulse {
    from { text-shadow: 0 0 15px rgba(245, 158, 11, 0.5), 0 0 30px rgba(245, 158, 11, 0.3); }
    to { text-shadow: 0 0 25px rgba(245, 158, 11, 0.8), 0 0 50px rgba(245, 158, 11, 0.6); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .hud-header {
        left: 2%;
        right: 2%;
        top: 10px;
    }
    
    .back-link {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .hud-scoreboard {
        padding: 4px 15px;
        gap: 8px;
    }
    
    .score-display {
        font-size: 1.5rem;
    }
    
    .team-badge {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .hud-timer {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .game-title {
        font-size: 2rem;
    }
    
    .screen-content {
        padding: 25px 20px;
    }
    
    .controls-grid-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .p2-controls {
        display: none; /* Hide J2 controls in mobile touch */
    }

    #touch-overlay {
        display: flex;
    }
}
