/* 
 * بَوْح أسامة - النظام البصري الفاخر والتصميم المتجاوب RTL
 * Bawh Osama - Core Styles, Layouts & Themes
 */

/* ==========================================================================
   1. Core Variables & Design Tokens
   ========================================================================== */
:root {
    /* Fonts */
    --font-poems: 'Amiri', serif;
    --font-headings: 'Cairo', sans-serif;
    --font-prose: 'Tajawal', sans-serif;
    
    /* Colors - Dark Theme (Default: Velvet Navy & Midnight Purple) */
    --gold-primary: #a855f7;     /* Amethyst Purple */
    --gold-hover: #c084fc;       /* Glowing Orchid Purple */
    --gold-light: rgba(168, 85, 247, 0.12);
    --gold-glow: rgba(168, 85, 247, 0.35);
    
    --bg-main: #070612;          /* Midnight Navy Black */
    --bg-surface: #0e0c24;       /* Deep Velvet Navy */
    --bg-glass: rgba(14, 12, 36, 0.85);
    --bg-input: #17143a;
    
    --text-primary: #f5f3ff;     /* Soft warm lavender white */
    --text-secondary: #c7d2fe;   /* Cool slate indigo */
    --text-muted: #818cf8;       /* Soft iris */
    
    --border-color: rgba(168, 85, 247, 0.22);
    --border-focus: rgba(168, 85, 247, 0.6);
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    --shadow-gold: 0 0 15px rgba(168, 85, 247, 0.18);

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Light Theme overrides (Lavender Cream Theme) */
body.light-theme {
    --bg-main: #f5f3ff;          /* Lavender Cream */
    --bg-surface: #ffffff;       /* Pure white paper */
    --bg-glass: rgba(245, 243, 255, 0.85);
    --bg-input: #ede9fe;
    
    --text-primary: #1e1b4b;     /* Deep Royal Navy-Indigo */
    --text-secondary: #4338ca;   /* Indigo Slate */
    --text-muted: #6366f1;       /* Soft Indigo */
    
    --border-color: rgba(99, 102, 241, 0.22);
    --border-focus: rgba(99, 102, 241, 0.6);
    
    --shadow-sm: 0 4px 6px -1px rgba(99, 102, 241, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(99, 102, 241, 0.08);
    --shadow-lg: 0 20px 25px -5px rgba(99, 102, 241, 0.12);
    --shadow-gold: 0 0 15px rgba(99, 102, 241, 0.08);
}

/* ==========================================================================
   2. Reset & Core Typography
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: 100%;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-prose);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    transition: background-color 0.4s ease, color 0.4s ease;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-smooth);
}

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   3. Main Layout & Sticky Header
   ========================================================================== */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-headings);
    font-weight: 700;
    font-size: 1.5rem;
}

.logo-icon {
    font-size: 1.8rem;
    animation: writerFloat 3s ease-in-out infinite;
}

.accent-gold {
    color: var(--gold-primary);
    text-shadow: 0 0 10px var(--gold-light);
}

.main-nav {
    display: flex;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-family: var(--font-headings);
    font-weight: 500;
    font-size: 1rem;
    position: relative;
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--gold-primary);
    transition: var(--transition-smooth);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.studio-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--gold-light);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem !important;
    border-radius: 100px;
}

.studio-link:hover {
    background: var(--gold-primary);
    color: #12100e !important;
    border-color: var(--gold-primary);
    box-shadow: 0 0 10px var(--gold-glow);
}

.btn-icon {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-spring);
}

.btn-icon:hover {
    transform: scale(1.1) rotate(15deg);
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

body.dark-theme .icon-sun { display: none; }
body.light-theme .icon-moon { display: none; }

/* ==========================================================================
   4. SPA Main Viewport & Loading Animations
   ========================================================================== */
#app-viewport {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    position: relative;
    z-index: 10;
}

#app-viewport:has(.studio-view) {
    max-width: 1400px;
}

/* Page transitions */
.page-view {
    animation: elegantFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1.5rem;
}

.elegant-loader {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--gold-primary);
    border-radius: 50%;
    animation: ringPulse 1.8s ease-out infinite;
}

.pen-tip {
    font-size: 2.2rem;
    z-index: 2;
    animation: tipWiggle 1.5s ease-in-out infinite;
}

.loader-text {
    font-family: var(--font-headings);
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* ==========================================================================
   5. Hero Section & Blog Feed (Home View)
   ========================================================================== */
.hero-section {
    text-align: center;
    margin-bottom: 4rem;
    padding: 3rem 1.5rem;
    background: radial-gradient(circle at 50% 50%, var(--gold-light) 0%, transparent 60%);
    position: relative;
}

.hero-subtitle {
    font-family: var(--font-headings);
    color: var(--gold-primary);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 2px;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}

.hero-title {
    font-family: var(--font-headings);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 1.2rem;
}

.hero-desc {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Filter tabs */
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.tab-btn {
    font-family: var(--font-headings);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1.8rem;
    border-radius: 100px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    background-color: var(--bg-surface);
    transition: var(--transition-spring);
}

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

.tab-btn.active {
    background-color: var(--gold-primary);
    color: #12100e;
    border-color: var(--gold-primary);
    box-shadow: 0 8px 20px var(--gold-glow);
}

/* Post Cards Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.post-card {
    background-color: var(--bg-surface);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: var(--transition-spring);
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md), var(--shadow-gold);
    border-color: var(--gold-primary);
}

.card-header {
    height: 180px;
    position: relative;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.card-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-family: var(--font-headings);
    font-weight: 600;
    font-size: 0.75rem;
    background-color: rgba(18, 16, 14, 0.75);
    color: var(--gold-primary);
    padding: 0.3rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--gold-primary);
    backdrop-filter: blur(4px);
}

.card-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.4rem;
}

.card-title {
    font-family: var(--font-headings);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.card-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-read-more {
    font-family: var(--font-headings);
    font-weight: 600;
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-read-more svg {
    transition: var(--transition-spring);
}

.post-card:hover .btn-read-more svg {
    transform: translateX(-5px); /* Moves right because of RTL direction */
}

/* ==========================================================================
   6. Immersive Single Post View
   ========================================================================== */
.post-detail-view {
    max-width: 800px;
    margin: 0 auto;
}

.post-navigation {
    margin-bottom: 2rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-headings);
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1.2rem;
    border-radius: 100px;
    background: var(--bg-surface);
}

.btn-back:hover {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-gold);
}

.post-detail-header {
    border-radius: 20px;
    height: 300px;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.post-detail-meta {
    display: flex;
    gap: 1.5rem;
    font-family: var(--font-headings);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.post-detail-title {
    font-family: var(--font-headings);
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Content Layouts */
.post-detail-content {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 3.5rem 3rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 3rem;
}

/* Prose/Article custom styling */
.post-article-body {
    font-family: var(--font-prose);
    font-size: 1.15rem;
    line-height: 2;
    color: var(--text-primary);
    white-space: pre-wrap; /* Preserves paragraphs and newlines typed by the writer */
}

.post-article-body p {
    margin-bottom: 1.8rem;
}

.post-article-body h3 {
    font-family: var(--font-headings);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem 0;
    color: var(--gold-primary);
}

/* Custom Drop Cap for Arabic Prose */
.drop-cap-ar {
    font-size: 1.25rem;
}

.drop-cap-ar::first-line {
    font-weight: 700;
    color: var(--text-primary);
}

blockquote {
    margin: 2.5rem auto;
    padding: 1.5rem 2rem;
    border-right: 4px solid var(--gold-primary);
    background: var(--gold-light);
    border-radius: 4px 16px 16px 4px;
    font-style: italic;
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
    text-align: center;
    position: relative;
    max-width: 90%;
}

blockquote::before {
    content: "«";
    display: block;
    font-family: var(--font-poems);
    font-size: 2.5rem;
    color: var(--gold-primary);
    opacity: 0.5;
    margin-bottom: 0.5rem;
    line-height: 1;
}

blockquote::after {
    content: "»";
    display: block;
    font-family: var(--font-poems);
    font-size: 2.5rem;
    color: var(--gold-primary);
    opacity: 0.5;
    margin-top: 0.5rem;
    line-height: 1;
}

/* Poetry Layout */
.post-poem-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    font-family: var(--font-poems);
    font-size: 1.5rem;
    line-height: 1.8;
}

.poem-verse {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    transition: var(--transition-smooth);
    position: relative;
    border: 1px solid transparent;
}

.poem-verse:hover {
    background-color: var(--gold-light);
    border-color: var(--border-color);
}

.verse-part {
    text-align: justify;
    text-align-last: center;
    position: relative;
}

.verse-part-1 {
    text-align-last: justify;
}

.verse-part-2 {
    text-align-last: justify;
}

.verse-separator {
    color: var(--gold-primary);
    font-size: 0.9rem;
    user-select: none;
    opacity: 0.7;
}

/* Share Verse Button overlay */
.btn-share-verse {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    background-color: var(--bg-main);
    color: var(--gold-primary);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.8rem;
    border-radius: 100px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-headings);
    transition: var(--transition-spring);
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.poem-verse:hover .btn-share-verse {
    transform: translateY(-50%) scale(1);
}

.btn-share-verse:hover {
    background-color: var(--gold-primary);
    color: #12100e;
    box-shadow: 0 0 10px var(--gold-glow);
}

/* Single Post Interactions Bar */
.post-interactions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

.interaction-actions {
    display: flex;
    gap: 1rem;
}

.btn-like {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.8rem;
    border-radius: 100px;
    font-weight: 600;
    font-family: var(--font-headings);
    cursor: pointer;
    transition: var(--transition-spring);
}

.btn-like:hover {
    border-color: #ff4757;
    color: #ff4757;
    background-color: rgba(255, 71, 87, 0.05);
    transform: translateY(-3px);
}

.btn-like.liked {
    background-color: #ff4757;
    color: #ffffff;
    border-color: #ff4757;
    animation: heartBeat 0.4s ease;
}

.btn-share-post {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.8rem;
    border-radius: 100px;
    font-weight: 600;
    font-family: var(--font-headings);
    cursor: pointer;
    transition: var(--transition-spring);
}

.btn-share-post:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-gold);
}

/* ==========================================================================
   7. Premium Threaded Comment Section
   ========================================================================== */
.comments-section {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 3rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.comments-title {
    font-family: var(--font-headings);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-count {
    background-color: var(--gold-light);
    color: var(--gold-primary);
    font-size: 0.9rem;
    padding: 0.2rem 0.8rem;
    border-radius: 100px;
    border: 1px solid var(--gold-primary);
}

/* Comment Form */
.comment-form {
    margin-bottom: 3rem;
}

.form-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.2rem;
    align-items: start;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
    background-color: var(--bg-input);
}

.comment-input-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-field {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 10px var(--gold-glow);
}

textarea.input-field {
    min-height: 120px;
    resize: vertical;
}

.btn-primary {
    font-family: var(--font-headings);
    font-weight: 600;
    background-color: var(--gold-primary);
    color: #12100e;
    padding: 0.6rem 2rem;
    border-radius: 100px;
    cursor: pointer;
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-spring);
}

.btn-primary:hover {
    background-color: var(--gold-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--gold-glow);
}

/* Comments List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.comment-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.2rem;
    animation: elegantFadeIn 0.5s ease;
}

.comment-body {
    background-color: var(--bg-main);
    border-radius: 12px 0 12px 12px;
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--border-color);
    position: relative;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.comment-author-name {
    font-family: var(--font-headings);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gold-primary);
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comment-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ==========================================================================
   8. Writer's Studio & Editor (Dashboard View)
   ========================================================================== */
.studio-view {
    max-width: 1400px;
    margin: 0 auto;
}

.studio-grid {
    display: grid;
    grid-template-columns: 280px 1fr 380px;
    grid-template-areas: "sidebar editor helper";
    gap: 2rem;
    align-items: start;
}

[dir="rtl"] .studio-grid {
    grid-template-columns: 280px 1fr 380px;
    grid-template-areas: "sidebar editor helper";
}

[dir="ltr"] .studio-grid {
    grid-template-columns: 380px 1fr 280px;
    grid-template-areas: "helper editor sidebar";
}

/* Studio Mobile Navigation is hidden on desktop */
.studio-mobile-nav {
    display: none;
}

/* Studio Sidebar (Lists drafts/published) */
.studio-sidebar {
    grid-area: sidebar;
    background-color: var(--bg-surface);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar-title {
    font-family: var(--font-headings);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-new-post {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    background-color: var(--gold-primary);
    color: #12100e;
    border-radius: 100px;
    font-weight: 600;
}

.posts-list-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 500px;
    overflow-y: auto;
}

.sidebar-post-item {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.sidebar-post-item:hover, .sidebar-post-item.active {
    border-color: var(--gold-primary);
    background-color: var(--gold-light);
}

.sidebar-post-title {
    font-family: var(--font-headings);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.3rem;
}

.sidebar-post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Studio Editor Box */
.editor-box {
    grid-area: editor;
    background-color: var(--bg-surface);
    border-radius: 20px;
    padding: 3rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.editor-title {
    font-family: var(--font-headings);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--gold-primary);
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1.5rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-family: var(--font-headings);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.select-field {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.select-field:focus {
    border-color: var(--gold-primary);
}

/* Poetry Verses Editor */
.poetry-editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--bg-main);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.poetry-verse-edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: center;
}

.btn-remove-verse {
    color: #ff4757;
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition-smooth);
}

.btn-remove-verse:hover {
    transform: scale(1.1);
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-outline {
    font-family: var(--font-headings);
    font-weight: 600;
    border: 1px solid var(--border-color);
    padding: 0.6rem 2rem;
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-outline:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    background-color: var(--gold-light);
}

.btn-danger {
    font-family: var(--font-headings);
    font-weight: 600;
    background-color: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #ff4757;
    padding: 0.6rem 2rem;
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-danger:hover {
    background-color: #ff4757;
    color: #ffffff;
    border-color: #ff4757;
}

/* ==========================================================================
   9. About Author View
   ========================================================================== */
.about-view {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-surface);
    border-radius: 20px;
    padding: 4rem 3.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.about-header {
    text-align: center;
    margin-bottom: 3rem;
}

.about-avatar-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 1.5rem auto;
}

.about-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--gold-primary);
    background-color: var(--bg-main);
    box-shadow: var(--shadow-gold);
}

.about-title {
    font-family: var(--font-headings);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.about-subtitle {
    font-family: var(--font-headings);
    color: var(--gold-primary);
    font-size: 1.1rem;
    font-weight: 500;
}

.about-content {
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--text-secondary);
    margin-bottom: 3.5rem;
}

.about-content p {
    margin-bottom: 1.5rem;
}

.about-separator {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 3rem 0;
}

/* Message form */
.contact-section h3 {
    font-family: var(--font-headings);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* ==========================================================================
   10. Modals & Quote Card Generator UI
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(12, 10, 14, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-surface);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg), var(--shadow-gold);
    width: 100%;
    max-width: 900px;
    padding: 3rem;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.btn-close-modal {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem; /* left side because it is RTL */
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.btn-close-modal:hover {
    color: #ff4757;
    transform: rotate(90deg);
}

.modal-title {
    font-family: var(--font-headings);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--gold-primary);
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* Grid layout for quote generator */
.modal-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

#card-canvas-container {
    background-color: var(--bg-main);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 320px;
}

#card-canvas-container canvas {
    max-width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

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

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.control-label {
    font-family: var(--font-headings);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Gradient options circles */
.style-options {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.bg-chip {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-spring);
}

.bg-chip:hover {
    transform: scale(1.1);
}

.bg-chip.active {
    border-color: var(--gold-primary);
    box-shadow: 0 0 10px var(--gold-glow);
    transform: scale(1.1);
}

.font-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.btn-option {
    text-align: right;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    cursor: pointer;
    font-family: var(--font-headings);
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

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

.btn-option.active {
    border-color: var(--gold-primary);
    background-color: var(--gold-light);
    color: var(--gold-primary);
    font-weight: 600;
}

.range-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.range-container input[type="range"] {
    flex: 1;
    accent-color: var(--gold-primary);
    cursor: pointer;
}

.range-container span {
    font-size: 0.85rem;
    font-family: var(--font-headings);
    width: 60px;
    text-align: left;
}

.btn-full-width {
    width: 100%;
    justify-content: center;
    padding: 0.8rem 2rem;
    margin-top: 0.5rem;
}

/* Sharing modal details */
.share-content-modal {
    max-width: 450px;
    text-align: center;
}

.share-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    transition: var(--transition-spring);
    font-family: var(--font-headings);
    font-weight: 500;
    font-size: 0.9rem;
}

.share-btn:hover {
    transform: translateY(-5px);
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-gold);
}

.share-icon {
    font-size: 1.8rem;
}

/* ==========================================================================
   11. Footer Styling
   ========================================================================== */
.main-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-quote {
    font-family: var(--font-headings);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gold-primary);
    margin-bottom: 1.5rem;
}

.footer-separator {
    width: 80px;
    height: 2px;
    background-color: var(--gold-primary);
    margin: 1.5rem auto;
    opacity: 0.5;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-link {
    font-family: var(--font-headings);
    color: var(--text-secondary);
}

.footer-link:hover {
    color: var(--gold-primary);
    text-shadow: 0 0 5px var(--gold-light);
}

/* ==========================================================================
   12. Keyframes Animations
   ========================================================================== */
@keyframes elegantFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes writerFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(8deg); }
}

@keyframes ringPulse {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

@keyframes tipWiggle {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    25% { transform: translate(-2px, -2px) rotate(-5deg); }
    75% { transform: translate(2px, 2px) rotate(5deg); }
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   13. Responsive Adaptations (Media Queries)
   ========================================================================== */
@media (max-width: 1250px) {
    #app-viewport:has(.studio-view) {
        max-width: 100%;
        padding: 1.5rem 1rem;
    }
    
    .studio-grid {
        grid-template-columns: 220px 1fr 300px;
        gap: 1.2rem;
    }
    
    [dir="rtl"] .studio-grid {
        grid-template-columns: 220px 1fr 300px;
        grid-template-areas: "sidebar editor helper";
    }
    
    [dir="ltr"] .studio-grid {
        grid-template-columns: 300px 1fr 220px;
        grid-template-areas: "helper editor sidebar";
    }
    
    .editor-box {
        padding: 2rem;
    }
    
    .helper-panel, .studio-sidebar {
        padding: 1.5rem;
    }
}

@media (max-width: 1024px) {
    .studio-grid {
        grid-template-columns: 200px 1fr;
        grid-template-areas: 
            "sidebar editor"
            "helper helper";
        gap: 1.2rem;
    }
    
    [dir="rtl"] .studio-grid {
        grid-template-columns: 200px 1fr;
        grid-template-areas: 
            "sidebar editor"
            "helper helper";
    }
    
    [dir="ltr"] .studio-grid {
        grid-template-columns: 1fr 200px;
        grid-template-areas: 
            "editor sidebar"
            "helper helper";
    }
}

@media (max-width: 900px) {
    /* Responsive Studio Tab Bar for Mobile */
    .studio-mobile-nav {
        display: flex;
        justify-content: center;
        gap: 0.4rem;
        margin-bottom: 1.5rem;
        background-color: var(--bg-surface);
        padding: 0.4rem;
        border-radius: 100px;
        border: 1px solid var(--border-color);
    }
    
    .studio-mobile-nav-btn {
        flex: 1;
        font-family: var(--font-headings);
        font-weight: 600;
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        border-radius: 100px;
        cursor: pointer;
        transition: var(--transition-spring);
        text-align: center;
        color: var(--text-secondary);
    }
    
    .studio-mobile-nav-btn:hover {
        color: var(--text-primary);
    }
    
    .studio-mobile-nav-btn.active {
        background-color: var(--gold-primary);
        color: #12100e;
        box-shadow: 0 4px 12px var(--gold-glow);
    }

    /* Show/Hide Studio components based on active tab class on mobile */
    .studio-grid {
        display: block !important;
        gap: 0;
    }
    
    .studio-grid .studio-sidebar,
    .studio-grid .editor-box,
    .studio-grid .helper-panel {
        display: none !important;
        width: 100% !important;
        margin-bottom: 1.5rem;
    }
    
    .studio-grid.show-sidebar .studio-sidebar {
        display: block !important;
    }
    
    .studio-grid.show-editor .editor-box {
        display: block !important;
    }
    
    .studio-grid.show-helper .helper-panel {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Editor layout form rows stack beautifully */
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Posts Grid and Card responsiveness */
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.2rem;
    }

    .modal-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    #card-canvas-container {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    #app-viewport {
        padding: 1.5rem 1rem;
    }
    
    .header-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
    }
    
    .nav-links {
        gap: 1.2rem;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .post-detail-header {
        height: 200px;
        padding: 1.5rem;
    }
    
    .post-detail-title {
        font-size: 1.8rem;
    }
    
    .post-detail-content {
        padding: 2rem 1.5rem;
    }
    
    /* Poetry layout mobile centering & wrapping */
    .post-poem-body {
        font-size: 1.3rem;
        gap: 1.2rem;
    }
    
    .poem-verse {
        grid-template-columns: 1fr;
        gap: 0.4rem;
        text-align: center;
        padding: 0.8rem;
    }
    
    .verse-part {
        text-align: center !important;
        text-align-last: center !important;
    }
    
    .verse-separator {
        display: none;
    }
    
    .btn-share-verse {
        position: static;
        transform: none;
        display: inline-block;
        margin: 0.5rem auto 0 auto;
        opacity: 0.8;
    }
    
    .poem-verse:hover .btn-share-verse {
        transform: none;
    }
    
    .post-interactions-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .comments-section, .editor-box, .about-view {
        padding: 2rem 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .author-avatar {
        display: none;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    /* Responsive Modal Adaptations for Mobile Devices */
    .modal-overlay {
        padding: 0.5rem;
        align-items: flex-start;
        overflow-y: auto;
    }
    
    .modal-content {
        padding: 1.5rem 1.2rem;
        margin: 1.5rem auto;
        max-width: 95%;
        border-radius: 16px;
    }
    
    .modal-title {
        font-size: 1.4rem;
        margin-bottom: 0.4rem;
        padding-left: 2rem; /* Give room for close button on RTL left side */
    }
    
    .modal-subtitle {
        font-size: 0.82rem;
        margin-bottom: 1.2rem;
    }
    
    .btn-close-modal {
        top: 1rem;
        left: 1rem;
    }
    
    #card-canvas-container canvas {
        max-height: 340px; /* Fits beautifully within portrait displays */
    }
    
    .controls-column {
        gap: 1rem;
    }
    
    .ratio-options {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .ratio-options .btn-option {
        width: 100%;
        text-align: center !important;
        justify-content: center !important;
    }
    
    .btn-full-width {
        padding: 0.7rem 1.5rem;
    }
}

/* ==========================================================================
   14. Secure Author Studio Private Login & Logout Styles
   ========================================================================== */
.login-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg), var(--shadow-gold);
    max-width: 450px;
    width: 100%;
    margin: 4rem auto;
    padding: 3rem 2.5rem;
    text-align: center;
    animation: elegantFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-icon-large {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
    animation: writerFloat 3s ease-in-out infinite;
}

.login-card-title {
    font-family: var(--font-headings);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--gold-primary);
}

.login-card-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.login-error-msg {
    color: #ff4757;
    background-color: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.2);
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: none;
    text-align: right;
    animation: elegantFadeIn 0.3s ease;
}

.shake-box {
    animation: shakeEffect 0.5s ease-in-out;
}

@keyframes shakeEffect {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-10px); }
    30%, 60%, 90% { transform: translateX(10px); }
}

.btn-logout {
    font-family: var(--font-headings);
    font-weight: 600;
    background-color: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #ff4757;
    padding: 0.4rem 1rem;
    border-radius: 100px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    margin-top: 1rem;
    transition: var(--transition-smooth);
    width: 100%;
    justify-content: center;
}

.btn-logout:hover {
    background-color: #ff4757;
    color: #ffffff;
    border-color: #ff4757;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.2);
}

/* ==========================================================================
   14b. Studio Inbox (Mailbox) Styles
   ========================================================================== */
.btn-mailbox {
    font-family: var(--font-headings);
    font-weight: 600;
    background-color: rgba(214, 175, 55, 0.08);
    border: 1px solid rgba(214, 175, 55, 0.2);
    color: var(--gold-primary);
    padding: 0.5rem 1.2rem;
    border-radius: 100px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-top: 1rem;
    transition: var(--transition-smooth);
    width: 100%;
    justify-content: center;
}

.btn-mailbox:hover, .btn-mailbox.active {
    background-color: var(--gold-primary);
    color: #12100e;
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px var(--gold-glow);
}

.btn-mailbox .badge {
    background-color: #ff4757;
    color: white;
    border-radius: 50px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    margin-right: 0.4rem;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.3);
}

.message-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.8rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    margin-bottom: 1.5rem;
    animation: elegantFadeIn 0.4s ease;
    text-align: right;
}

.message-card:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 5px 15px rgba(214, 175, 55, 0.05);
    transform: translateY(-2px);
}

.message-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.message-sender-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.message-sender-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
    background-color: var(--bg-main);
}

.message-sender-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.message-sender-name {
    font-family: var(--font-headings);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.message-sender-email {
    font-size: 0.8rem;
    color: var(--gold-primary);
    text-decoration: none;
    transition: var(--transition-smooth);
    text-align: right;
}

.message-sender-email:hover {
    text-decoration: underline;
}

.message-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    align-self: center;
}

.message-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    background-color: var(--bg-main);
    padding: 1rem 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    text-align: right;
}

.message-actions {
    display: flex;
    justify-content: flex-end;
}

/* ==========================================================================
   15. Rich Formatting Toolbar Styles
   ========================================================================== */
.format-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px 10px 0 0;
    border-bottom: none;
    flex-wrap: wrap;
}

.btn-format {
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-headings);
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: var(--transition-spring);
}

.btn-format:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    transform: translateY(-1px);
}

/* Connect textarea to toolbar seamlessly */
.format-toolbar + textarea {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

/* ==========================================================================
   16. Tabbed Literary Helper Panel
   ========================================================================== */
.helper-panel {
    grid-area: helper;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-top: 0;
}

.helper-panel-title {
    font-family: var(--font-headings);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.helper-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.2rem;
    margin-bottom: 1.5rem;
}

.helper-tab-btn {
    cursor: pointer;
    font-family: var(--font-headings);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.6rem 0.5rem;
    color: var(--text-secondary);
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
    transition: var(--transition-spring);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.helper-tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--gold-primary);
    background-color: var(--gold-light);
    transform: translateY(-2px);
}

.helper-tab-btn.active {
    color: #ffffff;
    background-color: var(--gold-primary);
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px var(--gold-glow);
    transform: translateY(-2px);
}

.helper-tab-content {
    display: none;
    animation: elegantFadeIn 0.4s ease;
}

.helper-tab-content.active {
    display: block;
}

/* Synonym card and search results */
.synonym-search-box {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.synonyms-results {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.synonym-item {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: right;
}

.synonym-word {
    font-family: var(--font-headings);
    font-weight: 700;
    color: var(--gold-primary);
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.synonym-list {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Rhyme chips and letter selectors */
.letters-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.letter-btn {
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-headings);
    font-weight: bold;
    font-size: 0.9rem;
    transition: var(--transition-spring);
}

.letter-btn:hover, .letter-btn.active {
    border-color: var(--gold-primary);
    background-color: var(--gold-light);
    color: var(--gold-primary);
    transform: scale(1.1);
}

.rhymes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.8rem;
    max-height: 180px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.rhyme-chip {
    cursor: pointer;
    padding: 0.4rem;
    text-align: center;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    font-family: var(--font-poems);
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.rhyme-chip:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    background-color: var(--gold-light);
}

/* Tashkeel direct injection buttons */
.tashkeel-buttons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    width: 100%;
    justify-items: center;
}

.tashkeel-btn {
    cursor: pointer;
    width: 100%;
    max-width: 42px;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    font-size: 1.3rem;
    font-family: var(--font-poems);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-spring);
    user-select: none;
}

.tashkeel-btn:hover {
    border-color: var(--gold-primary);
    background-color: var(--gold-light);
    color: var(--gold-primary);
    transform: scale(1.1);
}

/* ==========================================================================
   17. Live Mini Card Previewer
   ========================================================================== */
.live-preview-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.mini-card-preview-box {
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1;
    margin: 1.5rem auto;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-md), var(--shadow-gold);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    border-width: 2px;
    border-style: solid;
    position: relative;
    overflow: hidden;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.mini-card-preview-box::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 10px;
    right: 10px;
    border: 1px dashed rgba(214, 175, 55, 0.25);
    border-radius: 12px;
    pointer-events: none;
}

.mini-card-header {
    font-family: var(--font-headings);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.mini-card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    width: 100%;
    gap: 0.8rem;
}

.mini-card-line {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
    text-align: center;
    white-space: normal;
    word-break: break-word;
}

.mini-card-divider {
    font-size: 0.8rem;
    opacity: 0.6;
}

.mini-card-footer {
    font-size: 0.8rem;
}

/* ==========================================================================
   18. Poetic Writing Prompt Generator
   ========================================================================== */
.prompt-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(12, 10, 14, 0.9);
    backdrop-filter: blur(12px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.prompt-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.prompt-card {
    background-color: var(--bg-surface);
    border: 2px solid var(--gold-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-lg), var(--shadow-gold), 0 0 30px var(--gold-glow);
    max-width: 500px;
    width: 100%;
    padding: 3.5rem 2.5rem;
    text-align: center;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.prompt-modal-overlay.open .prompt-card {
    transform: scale(1);
}

.prompt-title-fancy {
    font-family: var(--font-poems);
    font-size: 2.2rem;
    color: var(--gold-primary);
    margin-bottom: 1.5rem;
}

.prompt-body-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--gold-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-style: italic;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-prompt-refresh {
    font-family: var(--font-headings);
    font-weight: 600;
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary);
    background-color: var(--gold-light);
    padding: 0.6rem 2rem;
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition-spring);
}

.btn-prompt-refresh:hover {
    background-color: var(--gold-primary);
    color: #12100e;
    box-shadow: 0 0 15px var(--gold-glow);
}

/* ==========================================================================
   19. Premium Unified Scrollbars Styling
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary);
    box-shadow: 0 0 8px var(--gold-glow);
}

/* Firefox compatibility */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-main);
}

/* ==========================================================================
   20. Premium AI Literary Assistant Styles
   ========================================================================== */
.ai-settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    transition: var(--transition-smooth);
    margin-bottom: 1rem;
    width: 100%;
    justify-content: center;
}

.ai-settings-btn:hover {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
}

.ai-settings-panel {
    background-color: rgba(7, 6, 18, 0.6);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    display: none; /* Toggleable */
    flex-direction: column;
    gap: 0.8rem;
    animation: elegantFadeIn 0.3s ease;
}

.ai-settings-panel.open {
    display: flex;
}

.ai-presets-label {
    font-family: var(--font-headings);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    display: block;
    text-align: right;
}

.ai-presets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.ai-preset-btn {
    cursor: pointer;
    font-family: var(--font-headings);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-secondary);
    text-align: center;
    transition: var(--transition-spring);
}

.ai-preset-btn:hover {
    border-color: var(--gold-primary);
    color: var(--text-primary);
    background-color: var(--gold-light);
    transform: translateY(-1px);
}

.ai-prompt-area {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.ai-input {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    font-size: 0.9rem;
    line-height: 1.5;
}

.btn-consult-ai {
    width: 100%;
    justify-content: center;
    padding: 0.7rem;
    font-weight: bold;
    font-size: 0.9rem;
    background: linear-gradient(135deg, var(--gold-primary), #7c3aed);
    color: #ffffff;
    border-radius: 100px;
    box-shadow: 0 4px 15px var(--gold-glow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-family: var(--font-headings);
    transition: var(--transition-spring);
}

.btn-consult-ai:hover {
    background: linear-gradient(135deg, var(--gold-hover), #8b5cf6);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
    transform: translateY(-2px);
}

.ai-result-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: none;
    animation: elegantFadeIn 0.4s ease;
}

.ai-result-section.visible {
    display: block;
}

.ai-result-box {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.2rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    max-height: 250px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-bottom: 1rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
    text-align: right;
}

.ai-result-actions {
    display: flex;
    gap: 0.8rem;
}

.ai-shimmer-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 2rem 0;
    text-align: center;
}

.ai-shimmer-loader.active {
    display: flex;
}

.shimmer-pulse-bar {
    width: 100%;
    height: 12px;
    background: linear-gradient(90deg, var(--bg-main) 25%, var(--border-color) 50%, var(--bg-main) 75%);
    background-size: 200% 100%;
    animation: shimmerLoading 1.5s infinite linear;
    border-radius: 6px;
}

@keyframes shimmerLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.helper-tab-btn:last-child {
    grid-column: 1 / -1; /* Spans full width for premium layout balance! */
    background: linear-gradient(135deg, rgba(7, 6, 18, 0.8), rgba(23, 20, 58, 0.8));
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.helper-tab-btn:last-child:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 0 8px var(--gold-glow);
}

.helper-tab-btn:last-child.active {
    background: linear-gradient(135deg, var(--gold-primary), #7c3aed);
    color: #ffffff;
}

/* 600px Mobile Media Query for Stacking Poetry Editor Rows */
@media (max-width: 600px) {
    .poetry-verse-edit-row {
        grid-template-columns: 1fr !important;
        gap: 0.6rem !important;
        background-color: var(--bg-main);
        padding: 1.2rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        position: relative;
    }
    
    .poetry-verse-edit-row .btn-remove-verse {
        position: absolute;
        top: 8px;
        left: 8px;
        z-index: 5;
    }
    
    .poetry-verse-edit-row input.input-field {
        width: 100% !important;
        padding-left: 2rem !important; /* Prevent text overlap with remove button */
    }
}

/* ==========================================================================
   20. Interactive Paragraph & Blockquote Sharing Styles
   ========================================================================== */
.shareable-paragraph {
    position: relative;
    transition: var(--transition-smooth);
}

.shareable-paragraph:hover {
    background-color: var(--gold-light);
    border-radius: 8px;
    padding-right: 0.5rem;
    padding-left: 2.5rem !important;
}

.btn-share-paragraph {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    font-family: var(--font-headings);
    font-size: 0.72rem;
    background-color: var(--gold-primary);
    color: #12100e;
    border-radius: 100px;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    border: none;
    display: inline-flex;
    align-items: center;
}

.btn-share-paragraph:hover {
    background-color: var(--gold-hover);
    transform: translateY(-50%) scale(1.05);
}

.shareable-paragraph:hover .btn-share-paragraph,
.shareable-paragraph:focus-within .btn-share-paragraph {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

/* For mobile screen touch visibility */
@media (max-width: 900px) {
    .shareable-paragraph {
        padding-left: 0;
        margin-bottom: 2rem !important;
    }
    .shareable-paragraph:hover {
        background-color: transparent;
        padding-right: 0;
        padding-left: 0 !important;
    }
    .btn-share-paragraph {
        position: relative;
        left: auto;
        top: auto;
        transform: none !important;
        display: inline-flex;
        margin-top: 0.5rem;
        opacity: 1;
        visibility: visible;
        margin-right: auto;
    }
    .shareable-paragraph:hover .btn-share-paragraph {
        transform: none !important;
    }
}

