/* styles.css */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #1a1d29;
    color: white;
    border-radius: 20px;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}

webview#website {
    width: 100%;
    height: 100%;
    border: none;
    display: flex;
    flex: 1;
    background: transparent;
}

/* Overlay to cover webview until DOM manipulations are complete */
#embed-overlay {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 50;
}

#embed-overlay.hidden {
    opacity: 0;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #121425;
    color: white;
}

.logo span {
    font-size: 24px;
    font-weight: bold;
}

.nav-settings {
    display: flex;
    gap: 15px;
    align-items: center;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.content {
    flex: 2;
    overflow-y: auto;
}

.featured img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}

.featured {
    display: flex;
    position: fixed;
    width: 100%;
    background: #1a1d29;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    box-shadow: 0px 0px 10px 3px #000000d1;
    z-index: 100;
}

h2 {
    margin-bottom: 15px;
    font-size: 20px;
}

.recent-updates {
    display: flex;
    gap: 15px;
    height: 100%;
    flex-wrap: wrap;
    position: relative;
    /* for overlay positioning */
}

.update {
    background-color: #242a3b;
    border-radius: 8px;
    overflow: hidden;
    flex: 1 1 calc(33.333% - 15px);
    display: flex;
    flex-direction: column;
}

.update img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.update-info {
    padding: 10px;
}

.update-info h3 {
    font-size: 16px;
    margin: 0 0 10px;
}

.update-info p {
    font-size: 12px;
    color: #8e93a2;
    margin: 0;
}

.sidebar {
    width: 400px;
    background-color: #121425;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-logo img {
    width: 200px;
    height: auto;
}

.refresh-btn {
    background-color: #242a3b;
    color: greenyellow;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
}


.play-button {
    background-color: #00d4a4;
    color: #2b2d2d;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
}

.play-buttons {
    display: block;
    flex-direction: row;
    gap: 10px;
    width: 100%;
}

.logout-button {
    background-color: rgba(255, 0, 0, 0.6);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
    display: none;
}

.add-accounts {
    background-color: #00d4a4;
    color: #2b2d2d;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
    display: none;
}

.logout-button:hover,
.play-button:hover,
.add-accounts:hover {
    opacity: 0.9;
}

.game-info {
    width: 100%;
    margin-bottom: 20px;
    display: none;
}

.proxy-section {
    width: 100%;
    margin-bottom: 20px;
}

.proxy-section label {
    font-size: 14px;
    margin-bottom: 5px;
    display: block;
}

.game-info label {
    font-size: 14px;
    margin-bottom: 5px;
    display: block;
}

.game-info select {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: none;
    margin-bottom: 10px;
    background-color: #242a3b;
    color: #ffffff;
}

.proxy-section select {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: none;
    margin-bottom: 10px;
    background-color: #242a3b;
    color: #ffffff;
}

.proxy-section input {
    width: 95%;
    padding: 10px;
    border-radius: 5px;
    border: none;
    margin-bottom: 10px;
    background-color: #242a3b;
    color: #ffffff;
}

.pegi-rating img {
    width: 100px;
    height: auto;
    margin-bottom: 20px;
}

.links a {
    color: #00d4a4;
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
    text-align: center;
}

#loader {
    width: 100%;
    background-color: #f3f3f3;
    border-radius: 4px;
    margin-top: 20px;
    overflow: hidden;
    /* Ensure the bar stays within the container */
}

#progress-bar {
    width: 0;
    height: 30px;
    background-color: #4caf50;
    border-radius: 4px;
    text-align: center;
    line-height: 30px;
    color: white;
    transition: width 0.4s ease;
    position: relative;
    overflow: hidden;
}

#progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    opacity: 0.5;
    filter: blur(10px);
    animation: glowing 2s linear infinite;
    /* Animate the glow moving to the right */
}

@keyframes glowing {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}


#status {
    margin-top: 10px;
    font-size: 16px;
}

#loader-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    background: #242a3b;
    z-index: 125;
    width: 40%;
    margin: 1rem;
    border-radius: 10px;
    box-shadow: 3px 3px 3px 3px #00000040;
    padding: 2rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}


#update-available {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-actions {
    display: flex;
    justify-content: space-around;
    width: 450px;
}

#remind-me-later-btn {
    background-color: #1a1d29;
    border: 1px solid white;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    width: 200px;
    transition: transform 0.3s ease;
}

#remind-me-later-btn:hover {
    transform: scale(1.02);
}

#update-now-btn {
    background-color: #00d4a4;
    color: #2b2d2d;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    width: 200px;
    transition: transform 0.3s ease;
}

#update-now-btn:hover {
    transform: scale(1.02);
}

.loadingButton {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    position: relative;
}

.loadingButton.loading {
    pointer-events: none;
    color: transparent;
}

.loadingButton.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* titlebar layout: [hamburger button] [centered title that expands] [window controls] */
.titlebar {
    height: 30px;
    background: #242a3b;
    color: white;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    width: 100%;
    -webkit-app-region: drag;
    position: relative;
}

/* hamburger button */
.titlebar .hamburger {
    grid-column: 1;
    -webkit-app-region: no-drag;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 30px;
}

/* center title */
.titlebar .titlebar-title {
    grid-column: 2;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 0 8px;
    user-select: none;
}

/* right window control buttons */
.titlebar .titlebar-controls {
    grid-column: 3;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 30px;
    height: 30px;
    -webkit-app-region: no-drag;
}

.titlebar .titlebar-controls button,
.titlebar button.hamburger {
    background: transparent;
    border: none;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    padding: 0;
}

.titlebar .titlebar-controls button:hover,
.titlebar button.hamburger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.titlebar .titlebar-controls button:active,
.titlebar button.hamburger:active {
    background: rgba(255, 255, 255, 0.2);
}

.titlebar .titlebar-controls button:focus-visible,
.titlebar button.hamburger:focus-visible,
.app-menu .menu-item:focus-visible,
.app-menu .submenu-item:focus-visible {
    outline: 2px solid #00d4a4;
    outline-offset: -2px;
    background: rgba(255, 255, 255, 0.08);
}

/* hamburger/menu button */
button.hamburger {
    position: relative;
    width: 38px;
    min-width: 38px;
    height: 30px;
    -webkit-app-region: no-drag;
    cursor: pointer;
}

/* app menu popup */
.app-menu {
    position: absolute;
    top: 30px;
    left: 0;
    background: #121425;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 4px 0;
    font-size: 13px;
    z-index: 5000;
    -webkit-app-region: no-drag;
    animation: menuFadeIn 120ms ease;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-menu.hidden {
    display: none;
}

.app-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-menu .menu-item,
.app-menu .submenu-item {
    color: #ffffff;
    padding: 6px 14px;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
    position: relative;
}

.app-menu .menu-item:hover,
.app-menu .submenu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-menu .menu-item.has-sub>.menu-label::after {
    content: '';
}

/* submenu */
.app-menu .submenu {
    position: absolute;
    top: 0;
    left: 100%;
    background: #121425;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 4px 0;
    display: none;
}

.app-menu .menu-item.has-sub:hover>.submenu {
    display: block;
}

/* while menu is in the delayed closing phase keep submenus visible so they hide in sync */
.app-menu.closing .submenu {
    display: block !important;
}

.app-menu .separator {
    height: 1px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.1);
}

.app-menu .submenu-item {
    font-size: 12px;
}
