/**
 * Modern CSS styling for physics ball game
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a2b4b 0%, #2c3e60 100%);
    color: white;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    text-align: center;
    font-family: Arial, sans-serif;
    background: rgba(26, 43, 75, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: #f0f8ff;
}

.game-area {
    position: relative;
    display: inline-block;
    margin: 20px auto;
}

.canvas-container {
    position: relative;
    width: 500px;
    height: 900px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.background {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 900px;
    background: #1a1a2e url('./skybg.png') repeat-x center center;
    background-size: 800px 900px;
    opacity: 0.9;
    z-index: 0;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    pointer-events: none;
    will-change: transform;
}

.controls {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    min-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-group {
    margin-bottom: 25px;
}

.control-group h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 5px;
}

.control-item {
    margin-bottom: 15px;
}

.control-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #e0e6ed;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #333;
    outline: none;
    opacity: 0.8;
    transition: opacity 0.3s;
    cursor: pointer;
}

input[type="range"]:hover {
    opacity: 1;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

button {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    width: 100%;
    margin-bottom: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

button:active {
    transform: translateY(0);
}

.ai-button {
    background: linear-gradient(45deg, #4ecdc4, #2cb5e8);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.ai-button.active {
    background: linear-gradient(45deg, #2cb5e8, #4ecdc4);
    box-shadow: 0 4px 15px rgba(44, 181, 232, 0.5);
}

#gameStatus {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4ecdc4;
    margin-bottom: 10px;
}

#score {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.control-group p {
    color: #b8c6db;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* Mobile and tablet styles - simplified */
@media (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
        width: 100%;
        min-height: 100vh;
        overflow-x: hidden;
    }

    .game-container {
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .canvas-container {
        /* JavaScript will set these dimensions */
        border-radius: 0;
    }

    .controls {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 15px;
        border-radius: 15px 15px 0 0;
        box-sizing: border-box;
    }

    .background {
        /* JavaScript will adjust background proportionally */
    }

    .control-group {
        margin-bottom: 15px;
    }

    h1 {
        font-size: 1.8rem;
        margin: 10px 0;
    }

    .control-item {
        margin-bottom: 10px;
    }

    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    #gameStatus {
        font-size: 1rem;
    }

    #score {
        font-size: 1.1rem;
    }

    .physics-settings {
        margin-top: 15px;
        padding-top: 15px;
    }

    .physics-content {
        padding: 10px;
    }
}

@media (max-width: 380px) {
    .controls {
        padding: 10px;
    }

    .control-group {
        margin-bottom: 10px;
    }

    .control-item {
        margin-bottom: 8px;
    }

    button {
        padding: 8px 16px;
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
}

/* Animation for winning - more subtle */
.win-animation {
    animation: gentleCelebrate 1.5s ease-in-out;
}

@keyframes gentleCelebrate {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.02) rotate(0.5deg); }
    50% { transform: scale(1.03) rotate(-0.5deg); }
    75% { transform: scale(1.02) rotate(0.5deg); }
}

/* Screen shake animation for ground impact */
.screen-shake {
    animation: shake 0.2s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes shake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-5px, 0, 0); }
    50% { transform: translate3d(5px, 0, 0); }
    75% { transform: translate3d(-3px, 0, 0); }
}

.physics-settings {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.physics-settings .toggle-physics {
    width: 100%;
    background: linear-gradient(45deg, #2c3e50, #3498db);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.physics-settings .toggle-physics:hover {
    background: linear-gradient(45deg, #3498db, #2c3e50);
    transform: translateY(-2px);
}

.physics-settings.closed .physics-content {
    display: none;
}

.physics-content {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-controls {
    display: none; /* Hidden by default on desktop */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 33%; /* Bottom third of the screen */
    z-index: 2;
}

.touch-control {
    position: absolute;
    bottom: 0;
    width: 50%;
    height: 100%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
}

.touch-control:active {
    opacity: 0; /* Keep transparent even on press */
    background: transparent;
}

.left-control {
    left: 0;
}

.right-control {
    right: 0;
}

/* Show mobile controls only on touch devices and smaller screens */
@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
}

/* Overlay controls */
.overlay-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.overlay-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    min-width: 80px;
}

.overlay-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.overlay-btn.ai-toggle.active {
    background: rgba(78, 205, 196, 0.8);
    border-color: rgba(78, 205, 196, 1);
}

/* Admin toggle */
.admin-toggle {
    text-align: center;
    margin: 10px 0;
}

.admin-toggle button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.3s;
}

.admin-toggle button:hover {
    color: rgba(255, 255, 255, 0.6);
}

/* Hidden controls */
.controls.hidden {
    display: none;
}

.controls {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    min-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideDown 0.3s ease-out;
}

/* Mobile overlay adjustments */
@media (max-width: 768px) {
    .overlay-controls {
        top: 10px;
        right: 10px;
        gap: 8px;
    }

    .overlay-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
        min-width: 70px;
    }

    .admin-toggle {
        margin: 5px 0;
    }
} 