/* Frontend Game Styles for KidPower 3D Game */

.kp3d-game-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.kp3d-controls {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}

.kp3d-avatar-selector {
    flex: 1;
    min-width: 300px;
}

.kp3d-avatar-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.kp3d-avatar-selector select {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
}

.kp3d-button {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    margin-right: 10px;
}

.kp3d-button:hover {
    background: #005a87;
}

.kp3d-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#kp3d-fullscreen {
    background: #28a745;
}

#kp3d-fullscreen:hover {
    background: #218838;
}

.kp3d-button-exit {
    background: #dc3545;
}

.kp3d-button-exit:hover {
    background: #c82333;
}

.kp3d-status {
    margin-left: 15px;
    font-size: 14px;
    font-weight: 600;
}

.kp3d-status.success {
    color: #28a745;
}

.kp3d-status.error {
    color: #dc3545;
}

.kp3d-status.warning {
    color: #ffc107;
}

#kp3d-avatar-select option:disabled {
    color: #999;
    font-style: italic;
}

.kp3d-instructions {
    flex: 1;
    min-width: 250px;
}

.kp3d-instructions h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.kp3d-instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kp3d-instructions li {
    padding: 5px 0;
    color: #555;
    font-size: 14px;
}

#kp3d-game-canvas {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#kp3d-game-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.kp3d-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    z-index: 100;
}

.kp3d-loading.hidden {
    display: none;
}

.kp3d-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: kp3d-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes kp3d-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.kp3d-loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

/* Fullscreen Mode - using class added by JavaScript for reliable cross-browser support */
#kp3d-game-wrapper.kp3d-is-fullscreen {
    background: #000 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 999999 !important;
}

/* Hide controls and server status in fullscreen - only show game */
#kp3d-game-wrapper.kp3d-is-fullscreen .kp3d-controls {
    display: none !important;
}

#kp3d-game-wrapper.kp3d-is-fullscreen .kp3d-server-status {
    display: none !important;
}

/* Game canvas fills entire screen in fullscreen */
#kp3d-game-wrapper.kp3d-is-fullscreen #kp3d-game-canvas {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
}

/* Floating exit button in fullscreen */
#kp3d-fullscreen-exit {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999999;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#kp3d-fullscreen-exit:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.05);
}

#kp3d-game-wrapper.kp3d-is-fullscreen #kp3d-fullscreen-exit {
    display: block;
    animation: fade-in 0.3s ease;
}

/* Move lifeforce display below exit button in fullscreen (desktop) */
#kp3d-game-wrapper.kp3d-is-fullscreen #kp3d-lifeforce-display {
    top: 70px !important;
}

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

/* Prevent page scroll when game is focused */
#kp3d-game-canvas:focus {
    outline: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .kp3d-controls {
        flex-direction: column;
    }

    .kp3d-avatar-selector,
    .kp3d-instructions {
        width: 100%;
    }

    .kp3d-avatar-selector select {
        max-width: 100%;
    }
}

