/* components.css */
/* Styles for individual components, moved from style.css */

/* Loading Screen Styles */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent; /* Changed to transparent, curtain effect handles background */
    overflow: hidden;
    /* Initially visible */
    visibility: visible;
    opacity: 1;
    transition: visibility 0s linear 0.8s, opacity 0.3s ease-out; /* Match curtain transition delay */
}

#loading-overlay::before,
#loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: #000;
    z-index: 1;
    transition: transform 0.8s cubic-bezier(0.86, 0, 0.07, 1);
}

#loading-overlay::before {
    left: 0;
}

#loading-overlay::after {
    right: 0;
}

#loading-overlay.hidden {
    pointer-events: none;
    visibility: hidden; /* Hide element after transition */
    opacity: 0;
    transition: visibility 0s linear 0.8s, opacity 0.3s ease-out;
}

#loading-overlay.hidden .loading-content {
    opacity: 0;
    transform: scale(0.5) rotate(-15deg);
    transition: opacity 0.4s ease-out, transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

#loading-overlay.hidden::before {
    transform: translateX(-100%);
}

#loading-overlay.hidden::after {
    transform: translateX(100%);
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    position: relative;
    z-index: 2; /* Above the curtains */
    transition: opacity 0.3s ease-out, transform 0.5s ease-out;
}

.loading-logo {
    width: 80%;
    max-width: 300px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
    animation: logo-pulse 2.5s infinite cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.loading-bars {
    --speed-of-animation: 1s;
    --gap: 8px;
    --first-color: #4c86f9;
    --second-color: #49a84c;
    --third-color: #f6bb02;
    --fourth-color: #e94235;
    --fifth-color: #2196f3;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    gap: var(--gap);
    height: 80px;
}

.loading-bars span {
    width: 6px;
    height: 60px;
    border-radius: 3px;
    animation: scale var(--speed-of-animation) ease-in-out infinite;
    filter: drop-shadow(0 0 5px currentColor);
}

.loading-bars span:nth-child(1) {
    background: linear-gradient(180deg, var(--first-color), #2a6de4);
    animation-delay: -0.9s;
}
.loading-bars span:nth-child(2) {
    background: linear-gradient(180deg, var(--second-color), #2d8c30);
    animation-delay: -0.8s;
}
.loading-bars span:nth-child(3) {
    background: linear-gradient(180deg, var(--third-color), #d8a002);
    animation-delay: -0.7s;
}
.loading-bars span:nth-child(4) {
    background: linear-gradient(180deg, var(--fourth-color), #c73125);
    animation-delay: -0.6s;
}
.loading-bars span:nth-child(5) {
    background: linear-gradient(180deg, var(--fifth-color), #1177d1);
    animation-delay: -0.5s;
}

@keyframes scale {
    0%, 40%, 100% {
        transform: scaleY(0.1);
    }
    20% {
        transform: scaleY(1);
    }
}

@keyframes logo-pulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px rgba(0, 242, 234, 0.4));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
    }
}


/* Game Viewer */
.game-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.game-viewer__content {
    background-color: var(--bg-charcoal-light);
    border: 2px solid var(--neon-teal);
    border-radius: var(--border-radius-card);
    width: 100%;
    max-width: 1400px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 242, 234, 0.3);
    overflow: hidden;
}

.game-viewer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.game-viewer__header h2 {
    font-size: 1.5rem;
    color: var(--neon-teal);
}

.game-viewer__main {
    flex-grow: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.game-viewer__iframe-container {
    flex-grow: 1;
    background-color: #000;
    width: 100%;
    height: 100%;
    display: flex; /* Added for centering iframe content if smaller */
    justify-content: center;
    align-items: center;
}

#game-viewer-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.game-viewer__instructions-panel {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 300px;
    max-height: calc(100% - 2rem);
    background-color: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    border-radius: var(--border-radius-control);
    padding: 1rem;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.game-viewer__instructions-panel h3 {
    color: var(--neon-green);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.game-viewer__instructions-panel p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.game-viewer__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid #333;
    flex-shrink: 0;
    background-color: var(--bg-charcoal-light);
}

.game-viewer__footer h2 {
    font-size: 1.5rem;
    color: var(--neon-teal);
    flex-grow: 1;
    text-align: center;
    margin: 0 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-viewer__footer-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.game-viewer__footer-controls button,
.game-viewer__footer-controls a {
    background-color: var(--bg-charcoal-dark);
    border: 1px solid #333;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.game-viewer__footer-controls button:hover,
.game-viewer__footer-controls a:hover {
    border-color: var(--neon-teal);
    color: var(--neon-teal);
    transform: translateY(-2px);
}

.game-viewer:fullscreen {
    padding: 0;
}

.game-viewer:fullscreen .game-viewer__content {
    max-width: none;
    height: 100%;
    border-radius: 0;
    border: none;
}

.game-viewer__version-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* New version buttons */
.game-version-btn {
    background-color: var(--bg-charcoal-dark);
    border: 1px solid #333;
    color: var(--text-primary);
    padding: 0.5rem 0.8rem; /* Adjusted padding for text */
    border-radius: var(--border-radius-control); /* Use control radius for rectangular shape */
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; /* Smaller font for version text */
    white-space: nowrap; /* Prevent text wrapping */
    min-width: 80px; /* Ensure buttons have consistent width */
    height: 40px; /* Match height of other circular buttons */
}

.game-version-btn:hover {
    border-color: var(--neon-teal);
    color: var(--neon-teal);
    transform: translateY(-2px);
}

/* Add styling for active version button */
.game-version-btn.active-version-btn {
    background-color: var(--neon-teal);
    color: var(--bg-charcoal-dark);
    border-color: var(--neon-teal);
    box-shadow: 0 0 8px var(--neon-teal);
}

#game-viewer-close-btn {
    font-size: 2rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0 0.5rem;
    line-height: 1;
}

#game-viewer-close-btn:hover {
    color: var(--accent-red);
    transform: scale(1.1) rotate(90deg);
}

.game-editor {
    padding: 1.5rem;
    background-color: #1a1a1a;
    border-top: 1px solid #333;
    flex-shrink: 0;
}

.game-editor h3 {
    margin-bottom: 1rem;
    color: var(--neon-green);
}

#edit-game-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#edit-game-form input, #edit-game-form textarea {
    background-color: var(--bg-charcoal-dark);
    border: 1px solid #333;
    color: var(--text-primary);
    border-radius: var(--border-radius-control);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
}

#edit-game-form input:focus, #edit-game-form textarea:focus {
    outline: none;
    border-color: var(--neon-green);
    box-shadow: 0 0 5px var(--neon-green);
}

.game-editor__buttons {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.game-editor__buttons button {
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-control);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.game-editor__buttons button[type="submit"] {
    background-color: var(--accent-green);
    color: var(--bg-charcoal-dark);
}

.game-editor__buttons button[type="button"] {
    background-color: #444;
    color: var(--text-primary);
}


/* Splash Screen Overlay */
.splash-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-charcoal-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.splash-screen-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.splash-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Game Description Tooltip */
.game-description-tooltip {
    position: fixed;
    background-color: rgba(30, 30, 30, 0.95); /* Semi-transparent dark background */
    border: 1px solid var(--neon-teal);
    border-radius: var(--border-radius-control);
    padding: 1rem;
    max-width: 300px;
    z-index: 1000; /* Below game viewer, above general content */
    opacity: 0;
    visibility: hidden; /* Use visibility for better transition and hiding */
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none; /* Allows clicks to pass through to elements beneath */
    box-shadow: 0 0 15px rgba(0, 242, 234, 0.2);
}

.game-description-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-recommendation-tag {
    background-color: var(--accent-gold);
    color: var(--bg-charcoal-dark);
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--border-radius-control);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.game-description-tooltip h3 {
    color: var(--neon-green);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    border-bottom: 1px solid #444;
    padding-bottom: 0.3rem;
}

.game-description-tooltip.recommended h3 {
    color: var(--accent-gold);
}

.game-description-tooltip p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    white-space: pre-wrap; /* Preserve line breaks in description */
    word-wrap: break-word; /* Break long words */
}

.game-description-tooltip p:last-child {
    margin-bottom: 0;
}