/* Common game header styles */
@media (max-width: 768px) {
    body {
        min-height: 100vh;
        width: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .container {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .container:has(.game-container) {
        min-height: 100vh;
    }
}

.home-icon {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    color: #333;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-icon i {
    font-size: 20px;
}

.home-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Enhanced floating game navigation menu - Fixed to left side */
.floating-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    width: 60px;
    transition: width 0.3s ease;
}

.floating-nav:hover {
    width: 250px;
}

.nav-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 0;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.nav-toggle:hover {
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
}

.nav-toggle.active {
    transform: none;
}

.nav-menu {
    position: absolute;
    top: 60px;
    left: 0;
    background: white;
    border-radius: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    padding: 15px 10px;
    width: 60px;
    height: calc(100vh - 60px);
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.floating-nav:hover .nav-menu {
    width: 250px;
    padding: 15px;
}

.nav-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav-menu h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.game-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 15px;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.game-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid #eee;
    background: #fafafa;
}

.game-link-logo {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 6px;
    padding: 4px;
    border: 1px solid #eee;
}

.game-link-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.game-link-name {
    flex: 1;
    font-weight: 500;
    line-height: 1.2;
}

.game-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    transform: translateX(3px);
}

.game-link:hover .game-link-logo {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
}

.nav-actions {
    padding-top: 0;
}

.nav-actions a {
    display: flex;
    align-items: center;
    padding: 12px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    background: #f8f9fa;
    white-space: nowrap;
    overflow: hidden;
}

.nav-actions a i {
    min-width: 24px;
    font-size: 18px;
    text-align: center;
}

.nav-actions a span {
    margin-left: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.floating-nav:hover .nav-actions a span {
    opacity: 1;
}

.nav-actions a:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    transform: translateX(3px);
}

/* Language dropdown styles */
.language-dropdown {
    position: relative;
    margin-top: 8px;
}

.language-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px;
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    white-space: nowrap;
    justify-content: center;
    gap: 8px;
}

.language-toggle i {
    min-width: 24px;
    font-size: 18px;
    text-align: center;
}

.language-toggle span {
    margin-left: 12px;
    opacity: 1;
    transition: opacity 0.3s ease;
    font-size: 14px;
}

.language-toggle:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(3px);
}

.language-menu {
    max-height: 0;
    overflow: hidden;
    position: static;
    background: #f8f9fa;
    border: none;
    border-radius: 6px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
    transition: max-height 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.language-menu.show {
    max-height: 600px;
    margin-top: 5px;
    overflow-y: auto;
}

.language-link {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.language-link:last-child {
    border-bottom: none;
}

.language-link:hover {
    background: #f8f9fa;
    text-decoration: none;
}

/* Quick access bar for popular games */
.quick-games-bar {
    display: none;
}

#quick-access-toggle {
    display: none;
    /* Hidden on desktop */
}

.quick-game-btn {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.quick-game-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

.quick-game-btn.home-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.quick-game-btn.home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Scrollbar styling for better visibility */
.nav-menu::-webkit-scrollbar,
.game-links::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-track,
.game-links::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.nav-menu::-webkit-scrollbar-thumb,
.game-links::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.nav-menu::-webkit-scrollbar-thumb:hover,
.game-links::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile and iPad optimizations */
@media (max-width: 1024px) {
    .floating-nav {
        top: 0;
        left: 0;
        width: 50px;
    }

    .floating-nav:hover {
        width: 220px;
    }

    .nav-toggle {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .nav-menu {
        width: 50px;
        top: 50px;
        height: calc(100vh - 50px);
        padding: 10px 5px;
    }

    .floating-nav:hover .nav-menu {
        width: 220px;
        padding: 12px;
    }

    .nav-actions a,
    .auth-link {
        padding: 10px 8px;
    }

    .nav-actions a i,
    .auth-link i {
        font-size: 16px;
        min-width: 20px;
    }

    .game-links {
        grid-template-columns: 1fr;
        max-height: 40vh;
    }

    .game-link-logo {
        width: 40px;
        height: 40px;
    }

    .game-link-name {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .quick-games-bar {
        position: fixed;
        bottom: 15px;
        left: 15px;
        transform: none;
        padding: 0;
        border-radius: 50%;
        width: 45px;
        height: 45px;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
        z-index: 50;
        pointer-events: auto;
    }

    .quick-games-bar.open {
        width: 180px;
        height: auto;
        border-radius: 15px;
        padding: 10px;
        align-items: stretch;
    }

    #quick-access-toggle {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 45px;
        height: 45px;
        background: none;
        border: none;
        color: white;
        font-size: 18px;
        cursor: pointer;
        padding: 0;
    }

    .quick-games-bar .quick-game-btn {
        display: none;
        padding: 8px 12px;
        font-size: 14px;
        text-align: center;
    }

    .quick-games-bar.open .quick-game-btn {
        display: block;
    }

    .quick-games-bar.open #quick-access-toggle {
        position: static;
        margin-bottom: 5px;
    }

    .quick-games-bar #try-text {
        display: none;
        /* Hide 'Try:' text on mobile */
    }

    .quick-game-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* iPad specific optimizations (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .floating-nav {
        width: 55px;
        left: 0;
    }

    .floating-nav:hover {
        width: 240px;
    }

    .nav-toggle {
        width: 55px;
        height: 55px;
        font-size: 20px;
    }

    .nav-menu {
        width: 55px;
        top: 55px;
        height: calc(100vh - 55px);
        padding: 12px 8px;
    }

    .floating-nav:hover .nav-menu {
        width: 240px;
        padding: 15px;
    }

    .game-links {
        grid-template-columns: 1fr 1fr;
        max-height: 50vh;
    }

    .quick-games-bar {
        position: fixed;
        bottom: 20px;
        left: 20px;
        transform: none;
        padding: 0;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
        z-index: 50;
        pointer-events: auto;
    }

    .quick-games-bar.open {
        width: 200px;
        height: auto;
        border-radius: 15px;
        padding: 12px;
        align-items: stretch;
    }

    #quick-access-toggle {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 50px;
        height: 50px;
        background: none;
        border: none;
        color: white;
        font-size: 20px;
        cursor: pointer;
        padding: 0;
    }

    .quick-games-bar .quick-game-btn {
        display: none;
        padding: 10px 14px;
        font-size: 15px;
        text-align: center;
    }

    .quick-games-bar.open .quick-game-btn {
        display: block;
    }

    .quick-games-bar.open #quick-access-toggle {
        position: static;
        margin-bottom: 8px;
    }

    .quick-games-bar #try-text {
        display: none;
    }
}

/* Animation for better UX */
@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.nav-menu.show {
    animation: bounceIn 0.5s ease;
}

/* Pulse effect for attention */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 4px 25px rgba(102, 126, 234, 0.6);
    }

    100% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
}

.nav-toggle.pulse {
    animation: pulse 2s infinite;
}

/* Game recommendation modal */
.recommendation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.recommended-games {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.recommended-game {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.recommended-game:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.close-modal {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.close-modal:hover {
    background: #5a6268;
}

@keyframes modalSlideIn {
    0% {
        transform: translateY(-50px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Special styling for current game indicator */
.game-link.current {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    font-weight: 600;
    border-color: #20c997;
}

.game-link.current .game-link-logo {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.98);
}

.game-link.current:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa085 100%);
    color: white;
}

/* Authentication styles for navigation */
.auth-section {
    border-top: 1px solid #e1e5e9;
    padding-top: 15px;
    margin-top: 15px;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-link {
    display: flex;
    align-items: center;
    padding: 12px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    border: 2px solid transparent;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
}

.auth-link i {
    min-width: 24px;
    font-size: 18px;
    text-align: center;
}

.auth-link span {
    margin-left: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.floating-nav:hover .auth-link span {
    opacity: 1;
}

.auth-link:hover {
    text-decoration: none;
    transform: translateX(3px);
}

.login-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.3);
}

.register-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.user-info-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-details-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    white-space: nowrap;
}

.user-avatar-nav {
    width: 35px;
    height: 35px;
    min-width: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.user-text {
    flex: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.floating-nav:hover .user-text {
    opacity: 1;
}

.user-email-nav {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 0.85rem;
}

.premium-status-nav {
    font-size: 0.7rem;
    margin-top: 2px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.premium-status-nav.premium {
    background: #28a745;
    color: white;
}

.premium-status-nav.free {
    background: #6c757d;
    color: white;
}

.signout-btn {
    background: #dc3545;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
    white-space: nowrap;
}

.signout-btn i {
    min-width: 16px;
}

.signout-btn span {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.floating-nav:hover .signout-btn span {
    opacity: 1;
}

.signout-btn:hover {
    background: #c82333;
    transform: translateX(3px);
}

/* Mobile responsiveness for auth */
@media (max-width: 768px) {
    .auth-section {
        margin-top: 10px;
        padding-top: 10px;
    }

    .user-details-nav {
        padding: 8px;
    }

    .user-avatar-nav {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .user-email-nav {
        font-size: 0.8rem;
    }

    .signout-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* Right side other games panel */
.other-games-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 260px;
    z-index: 100;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Scrollbar styling for games panel */
.other-games-panel::-webkit-scrollbar {
    width: 6px;
}

.other-games-panel::-webkit-scrollbar-track {
    background: transparent;
}

.other-games-panel::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 3px;
}

.other-games-panel::-webkit-scrollbar-thumb:hover {
    background: #b1b1b1;
}

/* Add margin to container when games panel exists */
.container:has(.other-games-panel) {
    margin-right: 290px;
}

@media (max-width: 1400px) {
    .container:has(.other-games-panel) {
        margin-right: 0;
    }
}

@media (min-width: 1600px) {
    .other-games-panel {
        width: 280px;
    }

    .container:has(.other-games-panel) {
        margin-right: 310px;
    }
}

@media (max-width: 1200px) {
    .other-games-panel {
        width: 220px;
        right: 10px;
    }

    .other-games-grid {
        gap: 8px;
    }

    .other-game-logo {
        width: 50px;
        height: 50px;
    }

    .other-game-name {
        font-size: 12px;
    }

    .other-games-panel h3 {
        font-size: 16px;
        padding: 10px 12px;
    }
}

@media (max-width: 1024px) {
    .other-games-panel {
        display: none;
    }

    .container:has(.other-games-panel) {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    /* Mobile hamburger menu at top */
    .floating-nav {
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
    }

    .floating-nav:hover {
        width: 100%;
    }

    .nav-toggle {
        width: 100%;
        height: 50px;
        border-radius: 0;
        font-size: 20px;
        justify-content: flex-start;
        padding-left: 20px;
    }

    .nav-toggle::after {
        content: 'Menu';
        margin-left: 10px;
        font-size: 16px;
        font-weight: 600;
    }

    .nav-menu {
        width: 100%;
        top: 50px;
        height: auto;
        max-height: 0;
        padding: 0;
        opacity: 0;
        visibility: hidden;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    .nav-menu.show {
        max-height: calc(100vh - 50px);
        padding: 15px;
        opacity: 1;
        visibility: visible;
    }

    .floating-nav:hover .nav-menu {
        width: 100%;
    }

    .game-links {
        grid-template-columns: repeat(2, 1fr);
        max-height: 50vh;
    }

    .nav-actions a span,
    .language-toggle span,
    .auth-link span,
    .user-text,
    .signout-btn span {
        opacity: 1 !important;
    }

    .other-games-panel {
        display: none;
    }
}

.other-games-panel h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.other-games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.other-game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: white;
    border: 2px solid #eee;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Desktop only - square cards */
@media (min-width: 1025px) {
    .other-game-card {
        aspect-ratio: 1;
    }
}

.other-game-card:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.5);
}

.other-game-logo {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    padding: 6px;
}

.other-game-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.other-game-card:hover .other-game-logo {
    background: rgba(255, 255, 255, 0.95);
}

.other-game-name {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.other-game-card.current {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: #20c997;
}

.other-game-card.current .other-game-logo {
    background: rgba(255, 255, 255, 0.98);
}


/* Responsive adjustments for other games panel */
@media (max-width: 1440px) {
    .other-games-panel {
        width: 240px;
    }

    .other-game-logo {
        width: 50px;
        height: 50px;
    }

    .other-game-name {
        font-size: 12px;
    }
}
