/**
 * ui.css
 * Styles for the UI system components
 */

/* UI Root Container */
.ui-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    font-family: Arial, sans-serif;
}

/* UI Layers */
.hud-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
}

.menu-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 1002;
}

.overlay-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 1003;
}

/* Base UI Element */
.ui-element {
    box-sizing: border-box;
    pointer-events: auto;
    transition: all 0.2s ease;
}

/* UI Panel */
.ui-panel {
    display: block;
}

/* UI Text */
.ui-text {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* UI Button */
.ui-button {
    display: inline-block;
    text-decoration: none;
    border: none;
    outline: none;
    text-align: center;
    vertical-align: middle;
    font-family: inherit;
    font-size: inherit;
    line-height: 1;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.ui-button:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    filter: brightness(1.1);
}

.ui-button:active,
.ui-button.pressed {
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    filter: brightness(0.9);
}

.ui-button.disabled {
    box-shadow: none;
    filter: brightness(0.6);
    cursor: not-allowed !important;
}

.ui-button.focused {
    box-shadow: 0 0 0 2px rgba(0, 136, 255, 0.5);
}

/* HUD Elements */
.ui-element[id*="health"] {
    font-family: 'Arial Black', Arial, sans-serif;
}

.ui-element[id*="score"] {
    font-family: 'Arial Black', Arial, sans-serif;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.ui-element[id*="crosshair"] {
    pointer-events: none;
}

/* Menu Styles */
.ui-element[id*="menu"] {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation Classes */
.ui-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.ui-fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.ui-slide-in-top {
    animation: slideInFromTop 0.4s ease forwards;
}

.ui-slide-in-bottom {
    animation: slideInFromBottom 0.4s ease forwards;
}

.ui-scale-in {
    animation: scaleIn 0.3s ease forwards;
}

/* Progress Bar Styles */
.ui-element[id*="progress"] .ui-panel[id*="fill"] {
    transition: width 0.3s ease;
}

/* Typewriter Effect */
.ui-text.typewriter::after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ui-button {
        min-height: 44px;
        font-size: 16px;
    }

    .ui-text {
        font-size: 14px;
    }

    .ui-element[id*="health"] {
        font-size: 12px;
    }
}

/* Accessibility */
.ui-button:focus {
    outline: 2px solid #0088ff;
    outline-offset: 2px;
}

.ui-element[aria-hidden="true"] {
    display: none !important;
}

/* Theme Support */
.ui-theme-dark {
    color: #ffffff;
}

.ui-theme-light {
    color: #000000;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ui-button {
        border-width: 3px;
    }

    .ui-text {
        text-shadow: 1px 1px 0 rgba(0,0,0,0.8);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ui-element,
    .ui-button {
        transition: none !important;
        animation: none !important;
    }
}