:root {
    --primary-color: #F7D002;
    /* Brand Yellow */
    --secondary-color: #1A1A1A;
    /* Brand Black */
    --accent-color: #C0392B;
    /* Moroccan Red Accent */
    --text-color: #333333;
    --bg-color: #FFFFFF;
    --alt-bg-color: #F9F9F9;
    --card-bg: #FFFFFF;
    --border-color: #E0E0E0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --font-family: 'Outfit', sans-serif;
    --transition: all 0.3s ease;

    /* RGB Values for Glassmorphism */
    --bg-rgb: 255, 255, 255;
    --primary-rgb: 247, 208, 2;
}

[data-theme="dark"] {
    --text-color: #F0F0F0;
    --bg-color: #121212;
    --alt-bg-color: #1E1E1E;
    --card-bg: #1E1E1E;
    --border-color: #333333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);

    --bg-rgb: 18, 18, 18;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden;
    /* Prevent horizontal scroll from mobile menu */
    /* Subtle geometric pattern */
    background-image:
        radial-gradient(circle at 100% 100%, transparent 8px, var(--bg-color) 8px, var(--bg-color) 9px, transparent 9px),
        radial-gradient(circle at 0 100%, transparent 8px, var(--bg-color) 8px, var(--bg-color) 9px, transparent 9px),
        radial-gradient(circle at 100% 0, transparent 8px, var(--bg-color) 8px, var(--bg-color) 9px, transparent 9px),
        radial-gradient(circle at 0 0, transparent 8px, var(--bg-color) 8px, var(--bg-color) 9px, transparent 9px);
    background-size: 40px 40px;
    background-attachment: fixed;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    letter-spacing: -0.5px;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
    color: var(--primary-color);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    /* Modern pill shape */
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(247, 208, 2, 0.4);
}

.btn-primary:hover {
    background-color: #ffd700;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(247, 208, 2, 0.6);
}

.btn-secondary {
    background-color: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

[data-theme="dark"] .btn-secondary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
}

/* Modern Floating Navbar */
header {
    background-color: transparent;
    border-bottom: none;
    position: sticky;
    top: 1rem;
    z-index: 1000;
    padding: 0;
    transition: all 0.4s ease;
    display: flex;
    justify-content: center;
}

header.scrolled {
    top: 0;
    padding: 0;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 95%;
    max-width: 1200px;
    background: rgba(var(--bg-rgb), 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 0.5rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
}

header.scrolled .navbar {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    background: rgba(var(--bg-rgb), 0.9);
    padding: 0.5rem 2rem;
    border: none;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
}

.logo-link {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 45px;
    width: auto;
    transition: var(--transition);
}

header.scrolled .logo-img {
    height: 40px;
}

.logo-img:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
}

.nav-links a {
    font-weight: 600;
    position: relative;
    font-size: 0.95rem;
    color: var(--text-color);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    transition: all 0.3s ease;
}

.nav-links a::after {
    display: none;
    /* Remove underline effect */
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--secondary-color);
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(247, 208, 2, 0.3);
}

[data-theme="dark"] .nav-links a:hover,
[data-theme="dark"] .nav-links a.active {
    color: var(--secondary-color);
    /* Keep text dark on yellow */
}

.controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* Search Bar */
.search-container {
    display: flex;
    align-items: center;
    background: rgba(var(--text-color), 0.05);
    border-radius: 20px;
    padding: 0.2rem;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-container.active {
    background: var(--bg-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(247, 208, 2, 0.2);
}

#search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    border-radius: 50%;
    transition: var(--transition);
}

#search-toggle:hover {
    background-color: rgba(var(--primary-rgb), 0.2);
    color: var(--primary-color);
}

#search-input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-color);
    transition: width 0.4s ease, padding 0.4s ease;
    font-family: inherit;
    font-size: 0.9rem;
}

.search-container.active #search-input {
    width: 150px;
    padding: 0 0.5rem;
}

#language-switcher {
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(var(--text-color), 0.2);
    border-radius: 20px;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

#language-switcher:hover {
    border-color: var(--primary-color);
}

#theme-toggle {
    background: rgba(var(--text-color), 0.05);
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-color);
}

#theme-toggle:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    transform: rotate(15deg);
}

[data-theme="dark"] .icon-sun {
    display: inline;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

[data-theme="light"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon {
    display: inline;
}

#mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

#mobile-menu-toggle span {
    width: 30px;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    padding: 8rem 0 6rem;
    position: relative;
    text-align: center;
    overflow: hidden;
}

/* Decorative Arch Background in Hero */
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 100%;
    background: radial-gradient(circle, rgba(247, 208, 2, 0.1) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}

.hero-content h1 {
    font-size: 4rem;
    /* Larger font */
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    color: var(--text-color);
    opacity: 0.8;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.video-placeholder {
    aspect-ratio: 16/9;
    background-color: #000;
    max-width: 900px;
    margin: 3rem auto 0;
    /* Moroccan Arch Shape */
    border-radius: 200px 200px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    overflow: hidden;
    /* Custom pattern background */
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
        repeating-linear-gradient(45deg, rgba(247, 208, 2, 0.1) 0, rgba(247, 208, 2, 0.1) 2px, transparent 2px, transparent 10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 4px solid var(--primary-color);
}

.play-button {
    width: 80px;
    height: 80px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--secondary-color);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 0 0 10px rgba(247, 208, 2, 0.3);
}

.video-placeholder:hover .play-button {
    transform: scale(1.1);
    box-shadow: 0 0 0 15px rgba(247, 208, 2, 0.3);
}

/* Sections */
.section {
    padding: 6rem 0;
}

.alt-bg {
    background-color: var(--alt-bg-color);
    /* Subtle geometric border top/bottom */
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* Episodes Grid */
.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Accent top border */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--primary-color);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.card-img {
    height: 220px;
    background-color: #ddd;
    object-fit: cover;
    /* Arch effect on image */
    border-radius: 0 0 50% 50% / 20px;
    margin-bottom: 1rem;
}

.card-content {
    padding: 1.5rem 2rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.card-title {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex: 1;
    color: var(--text-color);
    opacity: 0.8;
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

/* Comments */
.comment-form {
    max-width: 700px;
    margin: 0 auto 4rem;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(247, 208, 2, 0.1);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.comment-item {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    position: relative;
    padding-left: 2rem;
}

.comment-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 60%;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.7;
}

.comment-author {
    font-weight: 700;
    color: var(--secondary-color);
}

[data-theme="dark"] .comment-author {
    color: var(--primary-color);
}

/* Footer */
footer {
    background-color: var(--secondary-color);
    color: white;
    padding: 4rem 0;
    text-align: center;
    border-top: 10px solid var(--primary-color);
    position: relative;
}

/* Decorative top border for footer */
footer::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50% 50% 0 0;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.social-links a {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.social-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .logo {
    text-align: right;
}

[dir="rtl"] .nav-links {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

[dir="rtl"] .comment-item {
    padding-left: 1.5rem;
    padding-right: 2rem;
}

[dir="rtl"] .comment-item::before {
    left: auto;
    right: 0;
    border-radius: 4px 0 0 4px;
}

[dir="rtl"] .nav-links a::after {
    left: 50%;
    transform: translateX(50%);
}

/* Responsive */
@media (max-width: 1024px) {
    .hero-content h1 {
        font-size: 3.5rem;
    }

    .navbar {
        width: 100%;
        border-radius: 0;
        top: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(var(--bg-rgb), 0.95);
    }

    header {
        top: 0;
    }
}

@media (max-width: 768px) {
    header {
        top: 0;
        padding: 0;
    }

    .navbar {
        width: 100%;
        border-radius: 0;
        padding: 0.8rem 1rem;
        border: none;
        border-bottom: 1px solid rgba(var(--border-color), 0.5);
        background: rgba(var(--bg-rgb), 0.95);
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    /* Mobile Menu Drawer */
    #mobile-menu-toggle {
        display: flex;
        z-index: 1002;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--card-bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        padding: 2rem;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transform: translateX(100%);
        /* Move off-screen */
        transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        z-index: 1001;
        border-left: 1px solid var(--border-color);
        border-radius: 0;
    }

    .nav-links.active {
        transform: translateX(0);
        /* Slide in */
        right: 0;
        /* Ensure it stays anchored */
    }

    /* Overlay effect */
    .nav-links.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        /* Use viewport width */
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        opacity: 0;
        animation: fadeIn 0.4s forwards;
        pointer-events: none;
        transform: translateX(-100vw);
        /* Offset the parent transform */
        left: 100vw;
        /* Position correctly relative to parent */
    }

    /* Better Overlay approach: separate element, but sticking to CSS changes existing structure */
    /* Since .nav-links is the parent of the overlay, and it's transformed, the fixed overlay moves with it. 
       Let's use a huge pseudo-element that covers everything */

    .nav-links::before {
        content: '';
        position: fixed;
        top: 0;
        right: 100%;
        /* Positioned to the left of the menu */
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.4s ease;
    }

    .nav-links.active::before {
        opacity: 1;
        pointer-events: auto;
    }

    /* RTL adjustments for mobile */
    [dir="rtl"] .nav-links {
        right: auto;
        left: 0;
        transform: translateX(-100%);
        border-left: none;
        border-right: 1px solid var(--border-color);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    [dir="rtl"] .nav-links.active {
        transform: translateX(0);
        left: 0;
    }

    [dir="rtl"] .nav-links::before {
        right: auto;
        left: 100%;
    }
}