/* ==========================================================================
   CSS Variables & Tokens (Light Theme)
   ========================================================================== */
:root {
    /* User Specific Colors */
    --clr-primary: #4E4076; /* البنفسجي الأساسي */
    --clr-primary-light: #BF99C7; /* البنفسجي الفاتح */
    --clr-primary-soft: #D7B8DE; /* البنفسجي الناعم */
    --clr-secondary: #B9D0EC; /* الأزرق الفاتح */
    --clr-accent: #E4B055; /* الذهبي النجمي */
    --clr-beige: #FCEDD4; /* البيج الدافئ */
    --clr-bg-main: #FFF9F3; /* الخلفية الكريمية */
    
    /* Layout Colors */
    --clr-bg-card: #FFFFFF;
    --clr-bg-light: #FCEDD4; /* Using the beige for light backgrounds */
    --clr-text-dark: #2D3748;
    --clr-text-muted: #4A5568;
    --clr-white: #FFFFFF;
    --clr-header-bg: rgba(255, 249, 243, 0.9); /* Same as bg-main */

    /* Gradients */
    --grad-primary: linear-gradient(135deg, var(--clr-primary-light) 0%, var(--clr-primary-soft) 100%);
    --grad-secondary: linear-gradient(135deg, var(--clr-secondary) 0%, var(--clr-beige) 100%);
    --grad-accent: linear-gradient(135deg, var(--clr-accent) 0%, var(--clr-primary-light) 100%);

    /* Typography */
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Nunito', sans-serif;

    /* Shadows */
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px rgba(78, 64, 118, 0.15); /* Tinted shadow */
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 15px 35px rgba(191, 153, 199, 0.3);

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* ==========================================================================
   CSS Variables & Tokens (Dark Theme)
   ========================================================================== */
[data-theme="dark"] {
    --clr-primary: #D7B8DE; /* Lighter purple for text readability */
    --clr-primary-light: #4E4076; /* Darker purple for elements */
    --clr-primary-soft: #2D224D; /* Very dark purple */
    --clr-secondary: #4A6E99; /* Dark blue */
    --clr-accent: #E4B055; /* Gold stays */
    --clr-beige: #2A2433; /* Dark beige/purple */
    --clr-bg-main: #120F1A; /* Very dark background */
    
    --clr-bg-card: #1E192B; /* Dark card background */
    --clr-bg-light: #1A1624;
    --clr-text-dark: #F7FAFC; /* White-ish text */
    --clr-text-muted: #A0AEC0; /* Light gray text */
    --clr-white: #120F1A; /* Invert white to dark */
    --clr-header-bg: rgba(18, 15, 26, 0.9);

    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
    --shadow-hover: 0 15px 35px rgba(215, 184, 222, 0.2);
}

/* Dark Mode Global Fixes */
[data-theme="dark"] body {
    color: var(--clr-text-dark);
}

[data-theme="dark"] .main-nav a {
    color: var(--clr-text-dark);
}

[data-theme="dark"] .main-nav a.active {
    color: var(--clr-accent);
}

[data-theme="dark"] .mobile-menu-toggle span {
    background-color: var(--clr-text-dark);
}

[data-theme="dark"] footer {
    background: #0a0810;
    color: var(--clr-text-muted);
}

[data-theme="dark"] footer .footer-logo {
    color: var(--clr-primary);
}

[data-theme="dark"] select, 
[data-theme="dark"] input, 
[data-theme="dark"] textarea {
    background-color: var(--clr-bg-card);
    color: var(--clr-text-dark);
    border-color: var(--clr-primary-soft);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    transition: background-color var(--transition-normal);
    scrollbar-gutter: stable;
}

html, body {
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    font-family: var(--font-ar);
    background-color: var(--clr-bg-main);
    color: var(--clr-text-dark);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Language Display Logic */
html[lang="en"] .ar-text { display: none !important; }
html[lang="ar"] .en-text { display: none !important; }

html[lang="en"] body {
    font-family: var(--font-en);
}

/* Set specific fonts even for inner spans just in case */
.ar-text { font-family: var(--font-ar); }
.en-text { font-family: var(--font-en); }

img {
    max-width: 100%;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.text-center {
    text-align: center;
}

.bg-light {
    background-color: var(--clr-bg-light);
}

.section-header {
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--clr-primary);
    margin-bottom: 0.5rem;
}

.section-header .subtitle {
    font-size: 1.2rem;
    color: var(--clr-text-muted);
}

/* Unified Page Header Styles */
.page-header {
    padding: 6rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.page-title {
    font-size: 3rem;
    color: var(--clr-primary);
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.page-subtitle {
    font-size: 1.25rem;
    color: var(--clr-text-muted);
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.blob-bg-page {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: var(--grad-primary);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    z-index: 0;
    opacity: 0.15;
    animation: morph 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes morph {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    50% { border-radius: 60% 40% 50% 70% / 50% 60% 40% 60%; }
    100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
}

/* ==========================================================================
   Buttons & Controls
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn-primary {
    background: var(--clr-primary);
    color: #FFF9F3; /* Using cream for text on dark primary */
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    background: var(--clr-primary-light);
    color: var(--clr-text-dark);
}

[data-theme="dark"] .btn-primary {
    color: #120F1A;
}

.btn-secondary {
    background: var(--clr-bg-card);
    color: var(--clr-primary);
    border: 2px solid var(--clr-primary-light);
}

.btn-secondary:hover {
    background: var(--clr-primary-soft);
    color: var(--clr-text-dark);
    transform: translateY(-3px);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-xl {
    padding: 1.25rem 3rem;
    font-size: 1.5rem;
    border-radius: var(--radius-full);
}

.icon-btn, .lang-btn {
    background: var(--clr-bg-card);
    border: 2px solid var(--clr-primary-soft);
    color: var(--clr-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    transition: all var(--transition-fast);
}

.lang-btn {
    font-family: var(--font-en);
    font-size: 0.9rem;
}

.icon-btn:hover, .lang-btn:hover {
    background: var(--clr-primary-soft);
    transform: scale(1.05);
}

/* ==========================================================================
   Search & Cart
   ========================================================================== */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar {
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    background: var(--clr-bg-card);
    border: 2px solid var(--clr-primary-soft);
    border-radius: var(--radius-full);
    overflow: hidden;
    width: 0;
    opacity: 0;
    transition: width var(--transition-normal), opacity var(--transition-normal), padding var(--transition-normal);
    margin-right: 0.5rem;
}

html[dir="rtl"] .search-bar {
    right: auto;
    left: 100%;
    margin-right: 0;
    margin-left: 0.5rem;
}

.search-bar.active {
    width: 220px;
    opacity: 1;
    padding: 0 0.5rem;
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--clr-text-dark);
    padding: 0.5rem;
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--clr-text-muted);
}

.search-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.search-close:hover {
    color: var(--clr-primary);
}

.cart-btn {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--clr-accent);
    color: var(--clr-primary);
    font-size: 0.65rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

html[dir="rtl"] .cart-badge {
    right: auto;
    left: -4px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
header {
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    background: var(--clr-header-bg);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: background-color var(--transition-normal);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-img {
    height: 70px;
    width: auto;
    transition: transform var(--transition-fast);
}

.logo:hover .logo-img {
    transform: scale(1.05);
}

.main-nav {
    display: flex;
    gap: 2rem;
}

.main-nav a {
    font-weight: 600;
    position: relative;
    padding: 0.5rem 0;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--clr-accent);
    border-radius: 3px;
    transition: width var(--transition-normal);
}

html[dir="rtl"] .main-nav a::after {
    left: auto;
    right: 0;
}

.main-nav a:hover::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--clr-text-dark);
    border-radius: 3px;
    transition: all var(--transition-normal);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    padding: 6rem 0;
    overflow: hidden;
}

.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--clr-primary);
    text-shadow: 2px 2px 0 var(--clr-primary-soft);
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--clr-text-dark);
    margin-bottom: 1.5rem;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--clr-text-muted);
    margin-bottom: 2.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-visual {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
}

.hero-img {
    position: relative;
    z-index: 2;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: float 6s ease-in-out infinite;
    max-width: 90%;
}

.blob-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: var(--grad-primary);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    z-index: 1;
    opacity: 0.6;
    animation: morph 8s ease-in-out infinite;
}

.floating-element {
    position: absolute;
    font-size: 2rem;
    z-index: 3;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 0 10px var(--clr-accent));
}

.star-1 { top: 10%; right: 10%; animation-delay: 0s; }
.star-2 { bottom: 20%; left: 0; font-size: 3rem; animation-delay: 1s; }
.star-3 { top: 40%; left: -10%; animation-delay: 2s; }

html[dir="rtl"] .star-1 { right: auto; left: 10%; }
html[dir="rtl"] .star-2 { left: auto; right: 0; }
html[dir="rtl"] .star-3 { left: auto; right: -10%; }

/* ==========================================================================
   How It Works Section
   ========================================================================== */
.how-it-works {
    padding: 5rem 0;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    position: relative;
}

.step-card {
    background: var(--clr-bg-card);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal);
    position: relative;
    z-index: 2;
}

.step-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.step-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    background: var(--grad-secondary);
    color: var(--clr-primary);
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 8px 15px rgba(185, 208, 236, 0.4);
}

.step-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--clr-primary);
}

.step-card p {
    color: var(--clr-text-muted);
}

/* ==========================================================================
   Story Templates Section
   ========================================================================== */
.templates {
    padding: 5rem 0;
}

.popular-stories-label {
    margin: -0.5rem 0 2rem;
}

.popular-stories-label span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    background: var(--clr-primary-soft);
    color: var(--clr-primary);
    font-weight: 800;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
}

.templates-more {
    margin-top: 2.5rem;
}

.template-card {
    background: var(--clr-bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.template-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.card-img-wrapper {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.template-card:hover .card-img {
    transform: scale(1.05);
}

.gradient-bg-1 {
    background: var(--grad-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gradient-bg-2 {
    background: var(--grad-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-icon {
    font-size: 5rem;
}

.card-content {
    padding: 1.5rem;
}

.card-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--clr-primary);
}

.card-content p {
    color: var(--clr-text-muted);
    font-size: 0.95rem;
}

.card-footer {
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--clr-bg-card);
    border-top: 1px solid var(--clr-primary-soft);
    margin-top: auto;
}

/* ==========================================================================
   Why Hikaya Section
   ========================================================================== */
.why-us {
    padding: 6rem 0;
}

.why-us-container {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.why-us-content {
    flex: 1;
}

.why-us-content h2 {
    font-size: 2.5rem;
    color: var(--clr-primary);
    margin-bottom: 2rem;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.features-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--clr-bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.features-list li:hover {
    transform: translateX(10px);
}

html[dir="rtl"] .features-list li:hover {
    transform: translateX(-10px);
}

.feature-icon {
    font-size: 2rem;
    background: var(--clr-beige);
    color: var(--clr-primary);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.feature-text h4 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    color: var(--clr-primary);
}

.feature-text p {
    color: var(--clr-text-muted);
}

.why-us-visual {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
}

.circle-decoration {
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--grad-secondary);
    border-radius: 50%;
    z-index: 1;
    opacity: 0.3;
}

.floating-img {
    position: relative;
    z-index: 2;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: float 5s ease-in-out infinite alternate;
}

/* ==========================================================================
   Examples Section
   ========================================================================== */
.examples {
    padding: 5rem 0;
}

.examples-mockups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    align-items: start;
}

.mockup-card {
    perspective: 1000px;
    text-align: center;
}

.mockup-book {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--clr-bg-card);
    border-radius: 10px;
    box-shadow: -15px 15px 30px rgba(0,0,0,0.1);
    transform: rotateY(-15deg) rotateX(5deg);
    transition: transform var(--transition-normal);
    overflow: hidden;
    position: relative;
}

html[dir="rtl"] .mockup-book {
    box-shadow: 15px 15px 30px rgba(0,0,0,0.1);
    transform: rotateY(15deg) rotateX(5deg);
}

.mockup-card:hover .mockup-book {
    transform: rotateY(0deg) rotateX(0deg) scale(1.05);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.mockup-book img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mockup-card h3 {
    color: var(--clr-primary);
    font-size: 1.05rem;
    margin-top: 1rem;
}

.mockup-book::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.1), rgba(255,255,255,0.5));
    box-shadow: -1px 0 2px rgba(0,0,0,0.05);
}

/* ==========================================================================
   Final CTA
   ========================================================================== */
.final-cta {
    padding: 6rem 0;
    background: var(--clr-primary);
    position: relative;
    overflow: hidden;
}

.cta-title {
    font-size: 3rem;
    color: var(--clr-bg-main); /* Creamy background color */
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

[data-theme="dark"] .cta-title {
    color: #120F1A;
}

.pulse-animation {
    animation: pulse 2s infinite;
    position: relative;
    z-index: 2;
    background: var(--clr-accent);
    color: var(--clr-primary);
}

.pulse-animation:hover {
    background: var(--clr-bg-main);
    color: var(--clr-primary);
    animation: none;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    padding: 2rem 0;
    background: var(--clr-primary); /* Deep purple */
    color: var(--clr-bg-main);
}

[data-theme="dark"] footer {
    background: #000000;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--clr-accent);
}

footer p {
    color: rgba(255, 249, 243, 0.8);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

@keyframes morph {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    34% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; }
    67% { border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%; }
    100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes bounce {
    0% { box-shadow: 0 0 0 0 rgba(228, 176, 85, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(228, 176, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(228, 176, 85, 0); }
}

/* ==========================================================================
   WhatsApp Floating Button
   ========================================================================== */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #25D366;
    color: #fff;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    font-weight: 700;
    transition: all var(--transition-normal);
    animation: whatsappBounce 2s ease-in-out infinite;
}

html[dir="rtl"] .whatsapp-float {
    left: auto;
    right: 30px;
}

.whatsapp-float:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.55);
    animation: none;
}

.whatsapp-float svg {
    flex-shrink: 0;
}

@keyframes whatsappBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@media (max-width: 480px) {
    .whatsapp-float {
        bottom: 20px;
        left: 20px;
        width: 52px;
        height: 52px;
    }

    html[dir="rtl"] .whatsapp-float {
        left: auto;
        right: 20px;
    }
}
/* ==========================================================================
   Media Queries (Responsive to all devices)
   ========================================================================== */

/* Tablet landscape */
@media (max-width: 992px) {
    .hero-container, .why-us-container {
        flex-direction: column;
        text-align: center;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .why-us-visual {
        order: -1;
        margin-bottom: 3rem;
    }

    .features-list li {
        text-align: right;
    }

    html[dir="ltr"] .features-list li {
        text-align: left;
    }

    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* Tablet portrait & large phones */
@media (max-width: 768px) {
    /* Header */
    .header-container {
        flex-wrap: wrap;
    }

    .main-nav {
        display: none;
        width: 100%;
        order: 3;
        flex-direction: column;
        background: var(--clr-bg-card);
        padding: 1rem;
        box-shadow: var(--shadow-sm);
        border-radius: var(--radius-md);
        margin-top: 1rem;
        gap: 0.5rem;
    }

    .main-nav.active {
        display: flex;
    }

    .main-nav a {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-sm);
    }

    .main-nav a:hover {
        background: var(--clr-bg-light);
    }

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

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .d-none-mobile {
        display: none !important;
    }

    .logo-img {
        height: 55px;
    }

    /* Hero */
    .hero {
        padding: 3rem 0;
    }

    .hero-container {
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-desc {
        font-size: 1rem;
    }

    .hero-visual {
        max-width: 350px;
        margin: 0 auto;
    }

    /* Sections */
    .how-it-works, .templates, .examples, .why-us {
        padding: 3rem 0;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    /* Steps */
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .step-card {
        padding: 2rem 1.5rem;
    }

    /* Templates */
    .templates-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .card-img-wrapper {
        height: 160px;
    }

    .card-content {
        padding: 1rem;
    }

    .card-content h3 {
        font-size: 1.1rem;
    }

    .card-content p {
        font-size: 0.85rem;
    }

    /* Why Us */
    .why-us-container {
        gap: 2rem;
    }

    .why-us-content h2 {
        font-size: 2rem;
    }

    .circle-decoration {
        width: 280px;
        height: 280px;
    }

    .floating-img {
        max-width: 300px;
    }

    /* Examples */
    .mockup-book {
        width: 100%;
        max-width: 300px;
        height: 200px;
    }

    .examples-mockups {
        gap: 1.5rem;
    }

    /* CTA */
    .final-cta {
        padding: 4rem 0;
    }

    .cta-title {
        font-size: 2rem;
    }

    .btn-xl {
        padding: 1rem 2rem;
        font-size: 1.2rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        width: 92%;
    }

    .logo-img {
        height: 45px;
    }

    .header-actions {
        gap: 0.35rem;
    }

    .icon-btn, .lang-btn {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    /* Hero */
    .hero {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 1.7rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-desc {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .hero-visual {
        max-width: 280px;
    }

    .floating-element {
        font-size: 1.5rem;
    }

    .star-2 {
        font-size: 2rem !important;
    }

    /* Steps */
    .step-icon {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }

    .step-card h3 {
        font-size: 1.2rem;
    }

    /* Templates */
    .templates-grid {
        grid-template-columns: 1fr;
    }

    .card-img-wrapper {
        height: 200px;
    }

    /* Why Us */
    .features-list li {
        flex-direction: column;
        align-items: center;
        text-align: center !important;
    }

    html[dir="rtl"] .features-list li:hover,
    html[dir="ltr"] .features-list li:hover {
        transform: translateY(-5px);
    }

    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .feature-text h4 {
        font-size: 1rem;
    }

    .circle-decoration {
        width: 200px;
        height: 200px;
    }

    .floating-img {
        max-width: 220px;
    }

    /* Examples */
    .mockup-book {
        max-width: 260px;
        height: 180px;
        transform: rotateY(0) rotateX(0) !important;
        box-shadow: var(--shadow-md) !important;
    }

    /* CTA */
    .cta-title {
        font-size: 1.6rem;
    }

    .btn-xl {
        padding: 0.85rem 1.5rem;
        font-size: 1.1rem;
    }

    /* Footer */
    .footer-logo {
        font-size: 1.2rem;
    }

    footer p {
        font-size: 0.85rem;
    }
}

/* Very small phones (320px) */
@media (max-width: 360px) {
    .hero-title {
        font-size: 1.4rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .cta-title {
        font-size: 1.3rem;
    }

    .logo-img {
        height: 38px;
    }
}

/* ==========================================================================
   Cart Sidebar (Global)
   ========================================================================== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--clr-bg-card);
    z-index: 2000;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    transition: right 0.4s ease;
    display: flex;
    flex-direction: column;
}

html[dir="rtl"] .cart-sidebar {
    right: auto;
    left: -400px;
    box-shadow: 5px 0 25px rgba(0,0,0,0.1);
    transition: left 0.4s ease;
}

.cart-sidebar.open {
    right: 0;
}

html[dir="rtl"] .cart-sidebar.open {
    left: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cart-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--clr-primary-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    color: var(--clr-primary);
    font-size: 1.5rem;
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    line-height: 1;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.cart-empty {
    text-align: center;
    color: var(--clr-text-muted);
    margin-top: 2rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    background: var(--clr-bg-main);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    position: relative;
}

.cart-item-img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    color: var(--clr-text-dark);
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.cart-item-details {
    color: var(--clr-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.cart-item-price {
    color: var(--clr-primary);
    font-weight: 800;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #E53E3E;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    opacity: 0.7;
}

.remove-item-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    color: #C53030;
}

html[dir="rtl"] .remove-item-btn {
    /* No special RTL needed for flex-based icon */
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--clr-primary-soft);
    background: var(--clr-bg-light);
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--clr-primary);
    margin-bottom: 1rem;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#customer-info-form label {
    color: var(--clr-text-dark);
    font-weight: 700;
}

[data-theme="dark"] #customer-info-form {
    background: var(--clr-bg-card) !important;
    border-top-color: var(--clr-primary-soft) !important;
}

[data-theme="dark"] #customer-info-form label {
    color: var(--clr-text-dark) !important;
}

[data-theme="dark"] #customer-info-form input,
[data-theme="dark"] #customer-info-form textarea {
    background: var(--clr-bg-main) !important;
    color: var(--clr-text-dark) !important;
    border-color: var(--clr-primary-soft) !important;
}

[data-theme="dark"] #customer-info-form input::placeholder,
[data-theme="dark"] #customer-info-form textarea::placeholder {
    color: var(--clr-text-muted);
}

.order-submit-status {
    min-height: 1.4rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.5;
    color: var(--clr-text-muted);
}

.order-submit-status.is-pending {
    color: var(--clr-primary);
}

.order-submit-status.is-success {
    color: #238636;
}

.order-submit-status.is-error {
    color: #C53030;
}

[data-theme="dark"] .order-submit-status.is-success {
    color: #68D391;
}

[data-theme="dark"] .order-submit-status.is-error {
    color: #FC8181;
}

/* ==========================================================================
   Magical Cursor Trail Overlay
   ========================================================================== */
#magic-trail-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999;
    display: block;
}


/* Modal overlay and content for story preview */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    z-index: 1000000;
}
.modal.open {
    visibility: visible;
    opacity: 1;
}
.modal-content {
    background: var(--clr-bg-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    width: min(1040px, 92vw);
    max-width: 92vw;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#modal-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--clr-text-muted);
    transition: color var(--transition-fast);
}
#modal-close-btn:hover {
    color: var(--clr-primary);
}
.preview-grid {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
}

.preview-title {
    color: var(--clr-primary);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    padding: 0 2rem 0.25rem;
}

@media (max-width: 520px) {
    .modal-content {
        padding: 1.25rem;
        width: 94vw;
    }

    .preview-title {
        font-size: 1.35rem;
        padding-inline: 1.5rem;
    }
}
.book-pages {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background: var(--clr-bg-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.preview-slide-image {
    width: 100%;
    max-height: 68vh;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    border-radius: calc(var(--radius-sm) - 2px);
    display: block;
}
.nav-btn {
    background: var(--clr-primary);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    margin: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    z-index: 2;
    box-shadow: var(--shadow-md);
}

#prev-page-btn {
    left: 1rem;
}

#next-page-btn {
    right: 1rem;
}

.nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.page-indicators {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.indicator-dot {
    width: 11px;
    height: 11px;
    background: var(--clr-text-muted);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
}
.indicator-dot.active {
    background: var(--clr-primary);
}
.modal-order-btn {
    align-self: flex-end;
    margin-top: 1rem;
    background: var(--clr-accent);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
