/* CSS Variables for Dark Blue & Gold Theme */
:root {
    --bg-dark: #070d19;
    --bg-surface: #0e172a;
    --bg-surface-light: #152238;
    --primary-gold: #E5A967;
    --primary-gold-hover: #f0b575;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(14, 23, 42, 0.6);
}

.glass-panel {
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-panel:hover {
    background: rgba(25, 25, 25, 0.5);
    border-color: rgba(229, 169, 103, 0.2);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(229, 169, 103, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.glass-btn {
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(15px);
    transition: all 0.3s;
    cursor: pointer;
}

.glass-btn:hover {
    background: rgba(229,169,103,0.1);
    border-color: var(--primary-gold) !important;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.container {
    width: 96%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Navbar */
.navbar {
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary-gold);
}

.nav-links a.active {
    position: relative;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: var(--primary-gold);
    border-radius: 2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.icon-btn:hover {
    color: var(--primary-gold);
}

.mobile-menu-toggle {
    display: none;
}

/* Buttons */
.btn {
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-gold);
    color: var(--bg-dark);
}

.btn-primary:hover {
    background-color: var(--primary-gold-hover);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    background-color: var(--bg-dark);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary-gold);
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.social-icons a:hover {
    background-color: var(--primary-gold);
    color: var(--bg-dark);
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Hero Section */
.hero {
    position: relative;
    padding: 120px 0 80px 0;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    background-color: var(--bg-surface-light);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    /* Fade out the bottom of the hero section entirely */
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

/* Fallback gradient if no banner */
.hero:not([style*="background-image"]) {
    background: radial-gradient(circle at top, var(--bg-surface-light) 0%, var(--bg-dark) 70%);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to left, rgba(7, 13, 25, 0.95) 0%, rgba(7, 13, 25, 0.4) 60%, rgba(7, 13, 25, 0) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: right;
    max-width: 800px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-title span {
    color: var(--primary-gold);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
}

.search-bar {
    max-width: 600px;
    margin: 0 0 30px 0;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 15px 20px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.search-bar i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.categories-tags {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.tag {
    padding: 10px 25px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.4s ease;
}

.tag:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
}

/* Section Title */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 50px 0 30px;
}

.section-title {
    font-size: 1.5rem;
    color: var(--primary-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-all {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.view-all:hover {
    color: var(--text-primary);
}

/* Story Cards */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.story-card {
    background-color: var(--bg-dark);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    justify-content: flex-end;
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: rgba(229, 169, 103, 0.3);
}

.story-img-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-surface-light);
    z-index: 0;
}

.story-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(0,0,0,0.6);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    backdrop-filter: blur(5px);
    z-index: 2;
}

.story-info {
    padding: 50px 15px 15px;
    position: relative;
    z-index: 1;
    background: linear-gradient(to top, rgba(7, 13, 25, 1) 0%, rgba(7, 13, 25, 0.95) 40%, rgba(7, 13, 25, 0) 100%);
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

.story-title {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.story-author {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.story-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.story-stats i {
    margin-right: 5px;
}

/* Infinite Marquee Sliders */
.marquee-container {
    overflow: hidden;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
}

.marquee-track {
    display: flex;
    gap: 20px;
    width: max-content;
    animation: marquee-scroll 40s linear infinite;
}

.marquee-track.reverse {
    animation-direction: reverse;
}

.marquee-track:hover {
    animation-play-state: paused;
}

@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); } 
}

.marquee-track .story-card {
    width: 280px;
    flex-shrink: 0;
}

/* Game Interface */
.game-container {
    max-width: 800px;
    margin: 40px auto;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
}

.game-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background-color: var(--bg-surface-light);
}

.game-content {
    padding: 40px;
}

.game-title {
    font-size: 2rem;
    color: var(--primary-gold);
    margin-bottom: 20px;
    text-align: center;
}

.game-text {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 40px;
    text-align: justify;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-btn {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
    transition: all 0.3s;
    display: block;
}

.choice-btn:hover {
    border-color: var(--primary-gold);
    color: var(--primary-gold);
    background-color: rgba(229, 169, 103, 0.05);
    transform: translateX(-5px);
}

/* Authentication Forms */
.auth-container {
    max-width: 500px;
    margin: 60px auto;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.auth-title {
    font-size: 2rem;
    color: var(--primary-gold);
    text-align: center;
    margin-bottom: 30px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form p {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.auth-form label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: right;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    text-align: right;
}

.auth-form input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-gold);
    cursor: pointer;
}

.auth-form p:has(input[type="checkbox"]) {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.auth-form input:focus {
    border-color: var(--primary-gold);
}

.auth-form button {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    margin-top: 10px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-links a {
    color: var(--primary-gold);
}

.auth-links a:hover {
    text-decoration: underline;
}

.social-login {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background-color: white;
    color: #333;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    margin-top: 15px;
}

.btn-google:hover {
    background-color: #f1f1f1;
    transform: translateY(-2px);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: transparent; /* No dimming for bubble menu */
    z-index: 998;
    display: none; /* Changed from opacity to display for performance */
}

.mobile-overlay.active {
    display: block;
}

/* Responsive Design / Mobile Sidebar */
@media (max-width: 768px) {
    .nav-links {
        position: absolute;
        top: 70px;
        right: 20px;
        width: 250px;
        height: auto;
        background: rgba(15, 15, 15, 0.95) !important;
        backdrop-filter: blur(25px) saturate(200%) !important;
        -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        flex-direction: column;
        padding: 15px;
        gap: 10px;
        
        /* Bubble Animation */
        transform-origin: top right;
        transform: scale(0.8) translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 999;
        box-shadow: 0 15px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
    }
    
    .nav-links.active-mobile {
        transform: scale(1) translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-links a {
        padding: 12px 20px;
        font-size: 1.1rem;
        border-radius: 12px;
        margin: 0;
        background: rgba(255,255,255,0.03);
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .nav-links a.active::after {
        display: none;
    }
    
    .nav-links a:hover, .nav-links a.active {
        background-color: rgba(229, 169, 103, 0.15);
        border-right: none;
        transform: translateX(-5px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }
    
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 1001;
        position: relative;
        width: 45px;
        height: 45px;
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 12px;
        color: var(--primary-gold);
        transition: all 0.3s;
    }
    
    .mobile-menu-toggle:hover {
        background: rgba(229, 169, 103, 0.1);
        border-color: var(--primary-gold);
        transform: scale(1.05);
    }

    .user-welcome {
        display: none;
    }

    .login-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Live Search Results Box */
.search-results-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    margin-top: 10px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.8);
    z-index: 1000;
    display: none;
    text-align: right;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
}

.search-results-box.active {
    display: block;
}

.search-grid {
    display: flex;
    gap: 20px;
}

.search-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-column:first-child {
    border-left: 1px solid var(--border-color);
    padding-left: 20px;
}

.search-section-title {
    font-size: 1.1rem;
    color: var(--primary-gold);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(229, 169, 103, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 12px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.search-item:hover {
    background: var(--bg-surface-light);
    border-color: var(--border-color);
    transform: translateX(-5px);
}

.search-item-img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-gold);
    flex-shrink: 0;
}

.search-item-content {
    display: flex;
    flex-direction: column;
    text-align: right;
    flex-grow: 1;
}

.search-item-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.search-no-results {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .search-grid {
        flex-direction: column;
    }
    .search-column:first-child {
        border-left: none;
        padding-left: 0;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 20px;
    }
}

