/* =========================================
   1. SETUP & VARIABLES
   ========================================= */
/* Local Vazirmatn (already installed via npm) */
@import url('/static/css/vazirmatn.css');

/* For Fira Code, download it too */
@import url('/static/css/fira-code.css');
   
   :root {
       /* --- Colors --- */
       --bg-color: #0a0a0a;
       --bg-secondary: #121212;
       --bg-tertiary: #1e1e1e;
       
       --surface-color: #1a1a1a;
       --surface-hover: #222222;

       /*
       --bg-color: #0a0a0a;
       --bg-secondary: #121212;
       --bg-tertiary: #1e1e1e;
       
       --surface-color: #1a1a1a;
       --surface-hover: #222222;

       */
       
       /* --- Text Colors --- */
       --primary-text-color: #f0f0f0;
       --secondary-text-color: #b0b0b0;
       --tertiary-text-color: #808080;
       --code-text-color: #e6e6e6;
       
       /* --- Brand/Accent Colors --- */
       --accent-color: #ff6e1f;
       --accent-color-hover: #ff8542;
       --accent-color-dark: #e6631c;
       --accent-glow: rgba(255, 110, 31, 0.3);
       
       /* --- Functional Colors --- */
       --border-color: #2a2a2a;
       --border-hover: #3a3a3a;
       --success-color: #10b981;
       --error-color: #ef4444;
       --info-bg: rgba(59, 130, 246, 0.1);
       --info-border: #3b82f6;
       
       /* --- Shadows --- */
       --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
       --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
       --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
       --shadow-orange: 0 4px 20px rgba(255, 110, 31, 0.15);
       
       /* --- Dimensions --- */
       --radius-sm: 8px;
       --radius-md: 12px;
       --radius-lg: 16px;
       --header-height: 70px;
       
       /* --- Animation --- */
       --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
       
       /* --- Pico Overrides --- */
       --pico-font-family: 'Vazirmatn', sans-serif;
       --pico-background-color: var(--bg-color);
       --pico-color: var(--primary-text-color);
   }
   
   /* =========================================
      2. BASE STYLES & RESET
      ========================================= */
   * {
       margin: 0;
       padding: 0;
       box-sizing: border-box;
   }
   
   ::selection {
       background: var(--accent-color);
       color: #fff;
   }
   
   html {
       height: 100%;
       /* Ensures the background color persists during iOS 'bounce' scrolling */
       background-color: var(--bg-secondary); 
   }

   body {
       font-family: 'Vazirmatn', sans-serif;
       text-align: right;
       direction: rtl;
       /* Fixed attachment prevents background moving weirdly on mobile scroll */
       background: linear-gradient(135deg, var(--bg-color) 0%, var(--bg-secondary) 100%) fixed;
       color: var(--primary-text-color);
       line-height: 1.7;
       /* 100dvh adapts to mobile browser address bars better than 100vh */
       min-height: 100dvh; 
       display: flex;
       flex-direction: column;
       width: 100%;
       overflow-x: hidden;
   }

   /* Fix main container spacing */
   .main-content {
       flex: 1; /* This pushes the footer down naturally */
       padding-top: 3rem; 
       width: 100%;
       max-width: 1400px; 
       margin: 0 auto;
       /* Removed min-height: 80vh to prevent forcing scroll on short pages */
   }
   
   ::-webkit-scrollbar {
       width: 10px;
       height: 10px;
   }
   
   ::-webkit-scrollbar-track {
       background: var(--bg-color);
   }
   
   ::-webkit-scrollbar-thumb {
       background: var(--border-color);
       border-radius: 5px;
       border: 2px solid var(--bg-color);
   }
   
   ::-webkit-scrollbar-thumb:hover {
       background: var(--accent-color);
   }

   /* =========================================
      READING PROGRESS BAR
      ========================================= */
    .read-progress-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 4px;
        background: transparent;
        z-index: 9999;
        direction: ltr; 
    }

    .read-progress-bar {
        height: 4px;
        background: var(--accent-color);
        width: 0%;
        box-shadow: 0 0 10px var(--accent-color);
        transition: width 0.1s ease-out;
    }
   
   /* =========================================
      3. LAYOUT COMPONENTS (NAVBAR & FOOTER)
      ========================================= */
   .navbar {
       background: rgba(26, 26, 26, 0.85); /* Slightly more transparent for the cool effect */
       backdrop-filter: blur(20px);         /* Increased blur for the 'frosted glass' look under the Island */
       -webkit-backdrop-filter: blur(20px); /* Safari support */
       border-bottom: 1px solid var(--border-color);
       
       /* THE FIX: Add padding for the "Notch/Island" */
       padding-top: calc(0.8rem + env(safe-area-inset-top));
       padding-bottom: 0.8rem;
       
       position: sticky;
       top: 0;
       z-index: 100;
       box-shadow: var(--shadow-md);
       width: 100%;
   }
   
   .navbar .container {
       display: flex;
       justify-content: space-between;
       align-items: center;
       max-width: 1400px;
       margin: 0 auto;
       padding: 0 2rem;
       position: relative;
   }
   
   .navbar-brand {
       font-size: 1.5rem;
       font-weight: 800;
       color: var(--primary-text-color);
       text-decoration: none;
       display: flex;
       align-items: center;
       gap: 0.5rem;
       transition: var(--transition);
       z-index: 101;
   }
   
   .navbar-brand:hover {
       transform: translateY(-2px);
       text-shadow: 0 0 15px var(--accent-glow);
   }
   
   .navbar-brand strong span {
       color: var(--accent-color);
   }
   
   /* Desktop Nav Menu */
   .nav-menu {
       display: flex;
       align-items: center;
   }

   .navbar-nav {
       display: flex;
       list-style: none;
       gap: 1.5rem;
       align-items: center;
       margin: 0;
       padding: 0;
   }
   
   .navbar-nav a {
       color: var(--secondary-text-color);
       text-decoration: none;
       font-weight: 500;
       transition: var(--transition);
       padding: 0.5rem 1rem;
       border-radius: var(--radius-sm);
       white-space: nowrap; /* Prevent link text wrapping */
   }
   
   .navbar-nav a:hover {
       color: var(--primary-text-color);
       background: var(--surface-hover);
   }
   
   .navbar-nav .btn-primary {
       background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-dark) 100%);
       color: white !important;
       padding: 0.6rem 1.5rem !important;
       border-radius: var(--radius-sm);
       box-shadow: var(--shadow-orange);
   }
   
   .navbar-nav .btn-primary:hover {
       transform: translateY(-2px);
       box-shadow: 0 6px 25px rgba(255, 110, 31, 0.3);
       background: linear-gradient(135deg, var(--accent-color-hover) 0%, var(--accent-color) 100%);
   }

   /* Mobile Toggle Button (Hidden on Desktop) */
   .mobile-menu-toggle {
       display: none;
       background: transparent;
       border: 1px solid var(--border-color);
       color: var(--primary-text-color);
       font-size: 1.5rem;
       cursor: pointer;
       padding: 0.5rem;
       border-radius: var(--radius-sm);
       width: 45px;
       height: 45px;
       align-items: center;
       justify-content: center;
       z-index: 101;
   }

.site-footer {
       background: var(--surface-color);
       border-top: 1px solid var(--border-color);
       /* Adds space for iPhone Home Indicator Bar */
       padding: 3rem 0 calc(3rem + env(safe-area-inset-bottom)) 0; 
       margin-top: auto; 
       text-align: center;
       color: var(--secondary-text-color);
       width: 100%;
   }
   
 /* =========================================
      4. UI COMPONENTS (BUTTONS, CARDS)
      ========================================= */
      .btn {
        padding: 0.75rem 1.5rem;
        border-radius: var(--radius-sm);
        font-weight: 600;
        transition: var(--transition);
        border: none;
        cursor: pointer;
        text-decoration: none;
        font-size: 0.95rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1.5;
        width: auto !important;
        min-width: 100px;
    }
    
    .btn-primary {
        background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-dark) 100%);
        color: white !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.2);
        box-shadow: var(--shadow-orange);
    }
    
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(255, 110, 31, 0.4);
    }
    
    .btn-secondary {
        background: var(--surface-hover);
        color: var(--primary-text-color);
        border: 1px solid var(--border-color);
    }
    
    .btn-secondary:hover {
        background: var(--border-hover);
        border-color: var(--border-hover);
        transform: translateY(-2px);
    }
    
    .btn-danger {
        background: rgba(239, 68, 68, 0.1);
        color: var(--error-color);
        border: 1px solid var(--error-color);
    }
    
    .btn-danger:hover {
        background: var(--error-color);
        color: white;
        transform: translateY(-2px);
    }
    
    .text-white { color: white !important; }
 
    /* Share Buttons */
    .btn-outline-dark, .btn-outline-primary, .btn-outline-info {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 45px;
        height: 45px;
        border-radius: 50%;
        border: 1px solid;
        background: transparent;
        transition: var(--transition);
        font-size: 1.2rem;
        margin: 0 5px;
    }
 
    .btn-outline-dark {
        border-color: var(--secondary-text-color);
        color: var(--secondary-text-color);
    }
    .btn-outline-dark:hover {
        background: var(--surface-hover);
        color: white;
        border-color: white;
    }
 
    .btn-outline-primary {
        border-color: #0077b5;
        color: #0077b5;
    }
    .btn-outline-primary:hover {
        background: #0077b5;
        color: white;
        border-color: #0077b5;
    }
 
    .btn-outline-info {
        border-color: #0088cc;
        color: #0088cc;
    }
    .btn-outline-info:hover {
        background: #0088cc;
        color: white;
        border-color: #0088cc;
    }
    
    /* Modern Cards */
    article, .card {
        background: var(--surface-color);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 2rem;
        margin-bottom: 2rem;
        box-shadow: var(--shadow-md);
        transition: var(--transition);
        position: relative;
        overflow: hidden;
    }
    
    article:hover, .card:hover {
        border-color: var(--border-hover);
        box-shadow: var(--shadow-lg);
        transform: translateY(-3px);
    }
    
    article a, .card a {
        color: var(--accent-color);
        text-decoration: none;
        transition: var(--transition);
    }
    
    article a:hover {
        color: var(--accent-color-hover);
        text-shadow: 0 0 8px rgba(255, 110, 31, 0.2);
    }
    
    /* Flash Messages */
    .flash-message {
        padding: 1rem 1.5rem;
        border-radius: var(--radius-md);
        margin-bottom: 1.5rem;
        border-left: 4px solid;
        animation: slideIn 0.4s ease;
        display: flex;
        align-items: center;
        background: var(--surface-color);
        box-shadow: var(--shadow-sm);
    }
    
    @keyframes slideIn {
        from { transform: translateX(50px); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
    }
    
    .flash-success { border-color: var(--success-color); color: var(--success-color); }
    .flash-error { border-color: var(--error-color); color: var(--error-color); }
    .flash-info { border-color: var(--accent-color); color: var(--accent-color); }
    
   
   /* =========================================
      5. POST READING EXPERIENCE
      ========================================= */
   
   .post-content {
       font-size: 1.125rem;
       line-height: 1.9;
       color: #e0e0e0;
       margin-top: 2rem;
   }
   
   .post-content h1, 
   .post-content h2, 
   .post-content h3, 
   .post-content h4 {
       color: var(--primary-text-color);
       margin-top: 2.5rem;
       margin-bottom: 1rem;
       font-weight: 700;
       line-height: 1.4;
   }
   
   .post-content h2 {
       font-size: 1.75rem;
       border-bottom: 1px solid var(--border-color);
       padding-bottom: 0.75rem;
       position: relative;
   }
   
   .post-content h2::after {
       content: '';
       position: absolute;
       bottom: -1px;
       right: 0;
       width: 60px;
       height: 3px;
       background: var(--accent-color);
       border-radius: 2px;
   }
   
   .post-content h3 {
       font-size: 1.4rem;
       border-right: 4px solid var(--accent-color);
       padding-right: 1rem;
   }
   
   .post-content p {
       margin-bottom: 1.5rem;
       text-align: justify;
   }
   
   .post-content strong {
       color: white;
       font-weight: 700;
   }
   
   .post-content pre {
       background: #0d0d0d;
       border: 1px solid #333;
       border-radius: var(--radius-md);
       padding: 1.5rem;
       margin: 2rem 0;
       overflow-x: auto;
       position: relative;
       box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
   }
   
   .post-content pre::before {
       content: 'Code';
       position: absolute;
       top: 0;
       right: 0;
       background: #1f1f1f;
       padding: 2px 10px;
       border-bottom-left-radius: 8px;
       font-size: 0.75rem;
       color: var(--tertiary-text-color);
       border-bottom: 1px solid #333;
       border-left: 1px solid #333;
   }
   
   .post-content code {
       font-family: 'Fira Code', 'Courier New', monospace;
       font-size: 0.95rem;
       color: var(--code-text-color);
       direction: ltr;
       text-align: left;
   }
   
   .post-content p code {
       background: rgba(255, 110, 31, 0.1);
       color: var(--accent-color);
       padding: 0.2rem 0.4rem;
       border-radius: 4px;
       font-size: 0.9em;
   }
   
   .post-content blockquote {
       background: linear-gradient(to left, rgba(255, 110, 31, 0.05), transparent);
       border-right: 4px solid var(--accent-color);
       border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
       padding: 1.5rem;
       margin: 2rem 0;
       font-style: italic;
       color: var(--primary-text-color);
       position: relative;
   }
   
   .post-content blockquote::before {
       content: '"';
       position: absolute;
       top: -10px;
       right: 10px;
       font-size: 4rem;
       color: rgba(255, 110, 31, 0.1);
       font-family: serif;
       line-height: 1;
   }
   
   .post-content ul, .post-content ol {
       margin: 1.5rem 0;
       padding-right: 1.5rem;
   }
   
   .post-content ul li {
       margin-bottom: 0.75rem;
       list-style-type: none;
       position: relative;
   }
   
   .post-content ul li::before {
       content: '•';
       color: var(--accent-color);
       font-weight: bold;
       font-size: 1.2em;
       position: absolute;
       right: -1.2rem;
       top: -2px;
   }
   
   .post-content table {
       width: 100%;
       border-collapse: separate;
       border-spacing: 0;
       margin: 2rem 0;
       border: 1px solid var(--border-color);
       border-radius: var(--radius-sm);
       overflow: hidden;
       display: block; /* Make table responsive */
       overflow-x: auto;
   }
   
   .post-content th, .post-content td {
       padding: 1rem;
       border-bottom: 1px solid var(--border-color);
       text-align: right;
   }
   
   .post-content th {
       background-color: var(--bg-tertiary);
       color: var(--accent-color);
       font-weight: 600;
   }
   
   .post-content tr:last-child td {
       border-bottom: none;
   }
   
   .post-content tr:nth-child(even) {
       background-color: rgba(255, 255, 255, 0.02);
   }
   
   .post-content tr:hover {
       background-color: var(--surface-hover);
   }
   
   /* Media & Watermarking */
   .post-content img, .post-content video {
       max-width: 100%;
       height: auto;
       border-radius: var(--radius-md);
       margin: 2rem auto;
       display: block;
       box-shadow: var(--shadow-lg);
       border: 1px solid var(--border-color);
   }
   
   .watermark-container { position: relative; display: block; max-width: 100%; margin: 1.5rem auto; }
   .watermark-container iframe, .watermark-container video, .watermark-container img { margin: 0; max-width: 100%; }
   .watermark-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-wrap: wrap; justify-content: space-around; align-items: center; overflow: hidden; z-index: 10; pointer-events: none; }
   .watermark-overlay span { font-size: 2vw; font-weight: bold; color: rgba(255, 255, 255, 0.25); text-shadow: 0 0 5px rgba(0, 0, 0, 0.7); transform: rotate(-30deg); padding: 5%; white-space: nowrap; }

   video::-webkit-media-controls-fullscreen-button {
        display: none !important;
   }

   .custom-fullscreen-btn {
        position: absolute;
        bottom: 10px;
        left: 10px; 
        z-index: 20;
        background: rgba(0,0,0,0.6);
        color: white;
        border: none;
        border-radius: 4px;
        width: 36px;
        height: 36px;
        font-size: 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
   }
   .custom-fullscreen-btn:hover {
       background: var(--accent-color);
   }

   .watermark-container:fullscreen {
       width: 100vw;
       height: 100vh;
       background: black;
       display: flex;
       justify-content: center;
       align-items: center;
       border-radius: 0;
   }
   
   .watermark-container:-webkit-full-screen {
       width: 100%;
       height: 100%;
       background: black;
       display: flex;
       justify-content: center;
       align-items: center;
   }

   .watermark-container:fullscreen video,
   .watermark-container:-webkit-full-screen video {
       max-width: 100%;
       max-height: 100%;
       width: auto;
       height: auto;
       border: none;
       box-shadow: none;
       border-radius: 0;
   }
   
   
   /* =========================================
      6. AI ASSISTANT
      ========================================= */
   #ai-assistant-button {
       position: fixed;
       bottom: 30px;
       right: 30px;
       width: 60px;
       height: 60px;
       background: linear-gradient(135deg, var(--accent-color), var(--accent-color-dark));
       color: white;
       border-radius: 50%;
       display: flex;
       align-items: center;
       justify-content: center;
       font-size: 28px;
       font-weight: bold;
       font-family: 'Vazirmatn', sans-serif;
       cursor: pointer;
       z-index: 1000;
       box-shadow: var(--shadow-orange);
       transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
       border: 2px solid rgba(255, 255, 255, 0.1);
   }
   
   #ai-assistant-button:hover {
       transform: scale(1.1) rotate(5deg);
       box-shadow: 0 10px 25px rgba(255, 110, 31, 0.4);
   }
   
   #ai-assistant-popup {
       position: fixed;
       bottom: 110px;
       right: 30px;
       width: 380px;
       max-width: 90vw;
       height: 600px;
       max-height: 75vh;
       background: rgba(26, 26, 26, 0.95);
       backdrop-filter: blur(15px);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-lg);
       box-shadow: var(--shadow-lg);
       display: flex;
       flex-direction: column;
       z-index: 999;
       transition: all 0.3s ease;
       transform-origin: bottom right;
       overflow: hidden;
   }
   
   #ai-assistant-popup.hidden {
       opacity: 0;
       transform: scale(0.9) translateY(20px);
       pointer-events: none;
       visibility: hidden;
   }
   
   .chat-header {
       padding: 1rem 1.5rem;
       border-bottom: 1px solid var(--border-color);
       display: flex;
       justify-content: space-between;
       align-items: center;
       font-weight: 700;
       background: rgba(255, 255, 255, 0.03);
       color: var(--accent-color);
   }
   
   #close-chat-btn {
       background: none;
       border: none;
       font-size: 1.5rem;
       cursor: pointer;
       color: var(--secondary-text-color);
       transition: var(--transition);
       line-height: 1;
   }
   
   #close-chat-btn:hover {
       color: var(--error-color);
       transform: rotate(90deg);
   }
   
   #chat-history {
       flex-grow: 1;
       padding: 1.5rem;
       overflow-y: auto;
       display: flex;
       flex-direction: column;
       gap: 1rem;
       scroll-behavior: smooth;
   }
   
   .chat-message {
       padding: 0.85rem 1rem;
       border-radius: 18px;
       max-width: 85%;
       word-wrap: break-word;
       line-height: 1.6;
       font-size: 0.95rem;
       position: relative;
       animation: fadeUp 0.3s ease;
   }
   
   @keyframes fadeUp {
       from { opacity: 0; transform: translateY(10px); }
       to { opacity: 1; transform: translateY(0); }
   }
   
   .chat-message.user {
       background: var(--accent-color);
       color: white;
       align-self: flex-end;
       border-bottom-right-radius: 4px;
       box-shadow: 0 4px 15px rgba(255, 110, 31, 0.2);
   }
   
   .chat-message.bot {
       background: var(--surface-hover);
       color: var(--primary-text-color);
       align-self: flex-start;
       border-bottom-left-radius: 4px;
       border: 1px solid var(--border-color);
   }
   
   .chat-message.error {
       background: rgba(239, 68, 68, 0.15);
       color: var(--error-color);
       align-self: flex-start;
       border: 1px solid var(--error-color);
   }
   
   .chat-message.loading {
       display: flex;
       gap: 6px;
       padding: 1rem;
       width: fit-content;
   }
   
   .chat-message.loading span {
       width: 8px;
       height: 8px;
       background-color: var(--tertiary-text-color);
       border-radius: 50%;
       animation: bounce 1.4s infinite ease-in-out;
   }
   
   .chat-message.loading span:nth-child(1) { animation-delay: -0.32s; }
   .chat-message.loading span:nth-child(2) { animation-delay: -0.16s; }
   
   @keyframes bounce {
     0%, 80%, 100% { transform: scale(0); }
     40% { transform: scale(1); }
   }
   
   .chat-input-area {
       display: flex;
       padding: 1rem;
       background: var(--surface-color);
       border-top: 1px solid var(--border-color);
       gap: 0.75rem;
   }
   
   #chat-input {
       flex-grow: 1;
       background: var(--bg-secondary);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-md);
       color: var(--primary-text-color);
       padding: 0.75rem 1rem;
       transition: var(--transition);
   }
   
   #chat-input:focus {
       outline: none;
       border-color: var(--accent-color);
       box-shadow: 0 0 0 2px rgba(255, 110, 31, 0.1);
   }
   
   #chat-submit {
       display: flex;
       align-items: center;
       justify-content: center;
       width: 48px;
       height: 48px;
       border-radius: var(--radius-md);
       background: var(--accent-color);
       border: none;
       color: white;
       cursor: pointer;
       transition: var(--transition);
   }
   
   #chat-submit:hover {
       background: var(--accent-color-hover);
       transform: scale(1.05);
   }
   
   #chat-submit:disabled {
       background: var(--surface-hover);
       color: var(--tertiary-text-color);
       cursor: not-allowed;
       transform: none;
   }
   
   /* =========================================
      7. POST EDITOR STYLES
      ========================================= */
   .post-editor-container {
       max-width: 1100px;
       margin: 2rem auto;
       padding: 2.5rem;
       background: var(--surface-color);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-lg);
       box-shadow: var(--shadow-lg);
       width: 100%;
   }
   
   .editor-header h2 {
       font-size: 2rem;
       font-weight: 700;
       margin-bottom: 2rem;
       color: var(--primary-text-color);
       text-align: center;
   }
   
   .form-group {
       margin-bottom: 1.5rem;
   }
   
   .form-group label {
       display: block;
       margin-bottom: 0.75rem;
       font-weight: 600;
       color: var(--secondary-text-color);
   }
   
   .title-input {
       width: 100%;
       padding: 0.9rem 1.2rem;
       background-color: var(--bg-secondary);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-sm);
       color: var(--primary-text-color);
       font-size: 1.4rem;
       font-weight: 600;
       transition: var(--transition);
   }
   
   .title-input:focus {
       outline: none;
       border-color: var(--accent-color);
       box-shadow: 0 0 0 3px rgba(255, 110, 31, 0.2);
   }
   
   .editor-wrapper {
       background: var(--bg-secondary);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-md);
       overflow: hidden;
       transition: var(--transition);
       display: flex;
       flex-direction: column;
   }
   
   .editor-wrapper.focused {
       border-color: var(--accent-color);
       box-shadow: 0 0 0 3px rgba(255, 110, 31, 0.1);
   }
   
   .editor-wrapper.fullscreen {
       position: fixed;
       top: 0;
       left: 0;
       right: 0;
       bottom: 0;
       width: 100vw;
       height: 100vh;
       z-index: 9999;
       border-radius: 0;
       margin: 0;
   }
   
   .editor-wrapper.fullscreen .editor-content {
       min-height: calc(100vh - 60px);
       max-height: calc(100vh - 60px);
   }
   
   body.editor-fullscreen {
       overflow: hidden;
   }
   
   .editor-toolbar {
       display: flex;
       flex-wrap: wrap;
       gap: 0.5rem;
       padding: 0.75rem;
       background: var(--surface-color);
       border-bottom: 1px solid var(--border-color);
       align-items: center;
   }
   
   .toolbar-group {
       display: flex;
       gap: 0.25rem;
       padding: 0 0.5rem;
       border-left: 1px solid var(--border-color);
   }
   
   .toolbar-group:first-child {
       border-left: none;
       padding-right: 0.5rem;
   }
   
   .toolbar-btn {
       background: none;
       border: none;
       color: var(--secondary-text-color);
       cursor: pointer;
       font-size: 1rem;
       min-width: 34px;
       height: 34px;
       display: flex;
       align-items: center;
       justify-content: center;
       border-radius: var(--radius-sm);
       transition: var(--transition);
   }
   
   .toolbar-btn:hover {
       background: var(--surface-hover);
       color: var(--primary-text-color);
       transform: translateY(-1px);
   }
   
   .toolbar-select {
       background: var(--bg-secondary);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-sm);
       color: var(--primary-text-color);
       padding: 0.4rem 0.75rem;
       font-size: 0.875rem;
       cursor: pointer;
       transition: var(--transition);
       min-width: 100px;
   }
   
   .toolbar-select:focus {
       outline: none;
       border-color: var(--accent-color);
   }
   
   .editor-content {
       min-height: 400px;
       max-height: 600px;
       padding: 2rem;
       color: var(--primary-text-color);
       line-height: 1.8;
       outline: none;
       font-size: 1.05rem;
       overflow-y: auto;
   }
   
   .editor-content:empty::before {
       content: attr(data-placeholder);
       color: var(--tertiary-text-color);
       pointer-events: none;
   }
   
   .submit-btn {
       width: 100%;
       padding: 1rem;
       font-size: 1.2rem;
       font-weight: 700;
       background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-dark) 100%);
       color: white;
       border: none;
       border-radius: var(--radius-sm);
       cursor: pointer;
       transition: var(--transition);
       box-shadow: var(--shadow-orange);
       margin-top: 1rem;
   }
   
   .submit-btn:hover {
       transform: translateY(-2px);
       box-shadow: 0 6px 25px rgba(255, 110, 31, 0.4);
   }
   
   /* =========================================
      8. MODAL STYLES
      ========================================= */
   .modal-overlay {
       position: fixed;
       top: 0;
       left: 0;
       width: 100%;
       height: 100%;
       background: rgba(0, 0, 0, 0.8);
       backdrop-filter: blur(8px);
       z-index: 1000;
       opacity: 0;
       pointer-events: none;
       transition: opacity 0.3s ease;
   }
   
   .modal-overlay.active {
       opacity: 1;
       pointer-events: auto;
   }
   
   .modal {
       position: fixed;
       top: 50%;
       left: 50%;
       transform: translate(-50%, -50%) scale(0.95);
       background: var(--surface-color);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-lg);
       z-index: 1001;
       width: 90%;
       max-width: 450px;
       padding: 2rem;
       box-shadow: var(--shadow-lg);
       opacity: 0;
       pointer-events: none;
       transition: all 0.3s ease;
       max-height: 90vh;
       overflow-y: auto;
   }
   
   .modal.modal-wide {
       max-width: 700px;
   }
   
   .modal.active {
       opacity: 1;
       pointer-events: auto;
       transform: translate(-50%, -50%) scale(1);
   }
   
   .modal h3 {
       margin-bottom: 1.5rem;
       font-size: 1.5rem;
       text-align: center;
       color: var(--primary-text-color);
   }
   
   .modal-input, .file-input-wrapper {
       width: 100%;
       padding: 0.8rem;
       background: var(--bg-secondary);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-sm);
       color: var(--primary-text-color);
       margin-bottom: 1.2rem;
       transition: var(--transition);
   }
   
   .modal-input:focus {
       outline: none;
       border-color: var(--accent-color);
       background: var(--bg-color);
   }
   
   .modal-buttons {
       display: flex;
       gap: 1rem;
       justify-content: flex-end;
       margin-top: 1.5rem;
   }
   
   .modal-btn {
       padding: 0.7rem 1.5rem;
       border: none;
       border-radius: var(--radius-sm);
       font-weight: 600;
       cursor: pointer;
       transition: var(--transition);
   }
   .modal-btn.primary { background-color: var(--accent-color); color: white; }
   .modal-btn.primary:hover { background-color: var(--accent-color-hover); transform: translateY(-1px); }
   .modal-btn.secondary { background-color: var(--surface-hover); color: var(--primary-text-color); }
   .modal-btn.secondary:hover { background-color: var(--border-color); }
   
   .modal-tabs {
       display: flex;
       margin-bottom: 1.5rem;
       border-bottom: 1px solid var(--border-color);
   }
   
   .modal-tab {
       flex: 1;
       padding: 1rem;
       background: none;
       border: none;
       color: var(--secondary-text-color);
       cursor: pointer;
       transition: var(--transition);
       border-bottom: 2px solid transparent;
       font-weight: 500;
   }
   
   .modal-tab:hover {
       color: var(--primary-text-color);
       background: rgba(255,255,255,0.03);
   }
   
   .modal-tab.active {
       color: var(--accent-color);
       border-bottom-color: var(--accent-color);
   }
   
   .tab-content { display: none; }
   .tab-content.active { display: block; animation: fadeIn 0.3s ease; }
   
   @keyframes fadeIn {
       from { opacity: 0; }
       to { opacity: 1; }
   }
   
   .file-input-wrapper {
       position: relative;
       overflow: hidden;
       display: flex;
       align-items: center;
       justify-content: center;
       border: 2px dashed var(--border-color);
       background: var(--bg-secondary);
       min-height: 120px;
   }
   
   .file-input-wrapper:hover {
       border-color: var(--accent-color);
       background: rgba(255, 110, 31, 0.05);
   }
   
   .file-input-btn {
       color: var(--secondary-text-color);
       font-size: 1.1rem;
   }
   
   .file-input-wrapper input[type=file] {
       font-size: 100px;
       position: absolute;
       left: 0;
       top: 0;
       opacity: 0;
       cursor: pointer;
       width: 100%;
       height: 100%;
   }
   
   .special-chars-grid {
       display: grid;
       grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
       gap: 0.5rem;
       margin-bottom: 1rem;
   }
   
   .char-btn {
       background: var(--bg-secondary);
       border: 1px solid var(--border-color);
       border-radius: var(--radius-sm);
       color: var(--primary-text-color);
       padding: 0.5rem;
       font-size: 1.25rem;
       cursor: pointer;
       transition: var(--transition);
   }
   
   .char-btn:hover {
       background: var(--accent-color);
       color: white;
       transform: scale(1.1);
   }
   
   /* =========================================
      9. RESPONSIVE DESIGN (MOBILE FIXES)
      ========================================= */
   @media (max-width: 992px) {
       /* Navbar adjustments for tablets/mobile */
       .navbar .container {
           padding: 0 1.5rem;
           flex-wrap: wrap; /* Allow wrapping */
       }

       /* Show hamburger button */
       .mobile-menu-toggle {
           display: flex; 
       }

       /* Brand moves to the right side (RTL) */
       .navbar-brand {
           margin-left: auto;
       }

       /* Hide Nav items by default on mobile */
       .nav-menu {
           display: none;
           width: 100%;
           flex-direction: column;
           margin-top: 1rem;
           padding-top: 1rem;
           border-top: 1px solid rgba(255,255,255,0.1);
           animation: slideDown 0.3s ease-out;
       }

       /* Show nav items when active class is added via JS */
       .nav-menu.active {
           display: flex;
       }

       @keyframes slideDown {
           from { opacity: 0; transform: translateY(-10px); }
           to { opacity: 1; transform: translateY(0); }
       }

       .navbar-nav {
           flex-direction: column;
           width: 100%;
           gap: 0.5rem;
       }

       .navbar-nav li {
           width: 100%;
           text-align: center;
       }

       .navbar-nav a {
           display: block;
           width: 100%;
           padding: 0.8rem;
           background: rgba(255,255,255,0.03);
       }
       
       .nav-btn {
           width: 100% !important;
       }
       
       /* Fix Post Editor on Mobile */
       .post-editor-container {
           padding: 1.5rem;
       }
       
       .editor-toolbar {
           padding: 0.5rem;
           justify-content: center;
       }
       
       .toolbar-group {
           margin-bottom: 0.5rem;
       }
       
       .toolbar-btn {
           min-width: 32px;
           height: 32px;
       }

       /* AI Assistant Full Screen on Mobile */
       #ai-assistant-popup {
           bottom: 0;
           right: 0;
           width: 100%;
           height: 100%;
           max-height: 100vh;
           border-radius: 0;
           z-index: 2000;
       }
       
       #ai-assistant-button {
           bottom: 20px;
           right: 20px;
           width: 50px;
           height: 50px;
           font-size: 22px;
       }
       
       /* Font size adjustments */
       .post-content h2 { font-size: 1.5rem; }
       .post-content h3 { font-size: 1.25rem; }
       .navbar-brand { font-size: 1.3rem; }
   }