/*
Theme Name: Qodrat Educational Center
Theme URI: https://qudrateducationcenter.com/
Author: Qudrateducationcenter
Author URI: https://qudrateducationcenter.com/
Description: Qodrat theme for an educational center.
Version: 1.7
License: GNU General Public License v2 or later
Text Domain: qodrat
*/

/* Performance Optimizations */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth; /* Enable smooth scrolling */
    scroll-padding-top: 120px; /* Add padding for fixed header */
}

body {
    font-family: "Tajawal", sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-display: swap;
    /* Prevent layout shifts */
    min-height: 100vh;
    scroll-behavior: smooth;
}

/* Reduce layout shifts */
img, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-responsive {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.img-responsive:hover {
    transform: scale(1.02);
}

/* Touch targets optimization for mobile */
a, button, input, textarea, select {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

button, .btn {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px; /* Prevent zoom on iOS */
}

input, textarea, select {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Optimize font loading */
@font-face {
    font-family: 'Tajawal';
    font-display: swap;
    src: local('Tajawal');
}

/* Container queries for better responsive design */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
}

/* Critical above-the-fold styles moved to inline CSS in header */

/* Background and text color updates */

.bg-primary { background-color: #8A1538; }
.bg-secondary { background-color: #7A0A2C; }
.bg-dark { background-color: #222121; }
.bg-accent { background-color: #349FA5; }

.text-primary { color: #8A1538; }
.text-secondary { color: #7A0A2C; }
.text-dark { color: #222121; }
.text-accent { color: #349FA5; }

body {
    font-family: "Tajawal", sans-serif;
  }

  /* Mobile Menu (hidden on desktop) */
  #menu {
    transform: translateX(100%);
    transition: transform 0.5s ease-in-out;
    position: fixed;
    top: 0;
    right: 0;
    width: 250px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 20px;
    display: none;
  }
  #menu.open {
    display: block;
    transform: translateX(0);
  }

  /* Desktop Menu (visible on md+) */
  @media (min-width: 768px) {
    #menu {
      transform: none;
      position: relative;
      width: auto;
      height: auto;
      background: transparent;
      box-shadow: none;
      display: block !important;
      padding: 0;
    }
    #menu ul {
      display: flex;
      gap: 20px;
    }
  }

  /* Sticky nav on larger screens */
  header.sticky {
    position: sticky;
    top: 0;
    z-index: 50;
  }

/* Enhanced UI for sections */
.section-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #8A1538;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.25rem;
    color: #7A0A2C;
    margin-bottom: 2rem;
}

.section-content {
    background-color: #f9f9f9;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.section-content img {
    border-radius: 0.5rem;
    transition: transform 0.3s ease;
}

.section-content img:hover {
    transform: scale(1.05);
}

.section-button {
    background-color: #349FA5;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.section-button:hover {
    background-color: #7A0A2C;
}

/* Blog Post Content Styling */
.post-content {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #333;
}

/* Ensure article elements are not sticky */
article {
    position: relative !important;
}

article header {
    position: relative !important;
    top: auto !important;
    z-index: auto !important;
}

article h1 {
    position: relative !important;
    top: auto !important;
    z-index: auto !important;
}

/* Improve header spacing to prevent overlap */
.single-post header {
    margin-top: 1rem;
}

/* Ensure proper spacing from fixed navigation */
.single-post .max-w-7xl {
    padding-top: 2rem;
}

/* Headings */
.post-content h1 {
    font-size: 2.5rem;
    font-weight: bold;
    color: #8A1538;
    margin: 2rem 0 1rem 0;
    line-height: 1.2;
    border-bottom: 3px solid #349FA5;
    padding-bottom: 0.5rem;
    scroll-margin-top: 120px; /* Add scroll margin for proper anchoring */
    position: relative; /* Remove any potential sticky positioning */
}

.post-content h2 {
    font-size: 2rem;
    font-weight: bold;
    color: #7A0A2C;
    margin: 2rem 0 1rem 0;
    line-height: 1.3;
    position: relative;
    scroll-margin-top: 120px; /* Add scroll margin for proper anchoring */
}

.post-content h2::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: #349FA5;
    margin-right: -1rem;
}

.post-content h3 {
    font-size: 1.5rem;
    font-weight: bold;
    color: #8A1538;
    margin: 1.5rem 0 0.75rem 0;
    line-height: 1.4;
    scroll-margin-top: 120px; /* Add scroll margin for proper anchoring */
}

.post-content h4 {
    font-size: 1.25rem;
    font-weight: bold;
    color: #222121;
    margin: 1.25rem 0 0.5rem 0;
    scroll-margin-top: 120px; /* Add scroll margin for proper anchoring */
}

.post-content h5 {
    font-size: 1.1rem;
    font-weight: bold;
    color: #222121;
    margin: 1rem 0 0.5rem 0;
    scroll-margin-top: 120px; /* Add scroll margin for proper anchoring */
}

.post-content h6 {
    font-size: 1rem;
    font-weight: bold;
    color: #555;
    margin: 1rem 0 0.5rem 0;
    scroll-margin-top: 120px; /* Add scroll margin for proper anchoring */
}

/* Paragraphs */
.post-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
    color: #444;
}

.post-content p:first-child {
    font-size: 1.2rem;
    font-weight: 500;
    color: #222121;
}

/* Strong and Bold text */
.post-content strong,
.post-content b {
    font-weight: bold;
    color: #8A1538;
}

/* Emphasis and Italic text */
.post-content em,
.post-content i {
    font-style: italic;
    color: #7A0A2C;
}

/* Links */
.post-content a {
    color: #349FA5;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.post-content a:hover {
    color: #8A1538;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Lists */
.post-content ul,
.post-content ol {
    margin: 1.5rem 0;
    padding-right: 2rem;
}

.post-content ul li,
.post-content ol li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: #444;
}

.post-content ul {
    list-style-type: none;
}

.post-content ul li::before {
    content: "▶";
    color: #349FA5;
    font-weight: bold;
    margin-left: 0.5rem;
}

.post-content ol {
    list-style-type: decimal;
    list-style-position: outside;
}

.post-content ol li {
    padding-right: 0.5rem;
}

/* Blockquotes */
.post-content blockquote {
    background-color: #f8f9fa;
    border-right: 4px solid #349FA5;
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-style: italic;
    position: relative;
}

.post-content blockquote::before {
    content: "\201D";
    font-size: 4rem;
    color: #349FA5;
    position: absolute;
    top: -10px;
    right: 20px;
    opacity: 0.3;
}

.post-content blockquote p {
    margin-bottom: 0.5rem;
    color: #555;
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Images */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.post-content img:hover {
    transform: scale(1.02);
}

/* Tables */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background-color: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-content table th {
    background-color: #8A1538;
    color: white;
    padding: 1rem;
    text-align: right;
    font-weight: bold;
}

.post-content table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    color: #444;
}

.post-content table tr:hover {
    background-color: #f8f9fa;
}

/* Code blocks */
.post-content pre {
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
    overflow-x: auto;
    direction: ltr;
}

.post-content code {
    background-color: #f4f4f4;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #8A1538;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

/* Horizontal Rule */
.post-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to left, #349FA5, #8A1538);
    margin: 3rem 0;
    border-radius: 1px;
}

/* First Letter Enhancement - Removed for cleaner article appearance */

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-content {
        font-size: 1rem;
    }
    
    .post-content h1 {
        font-size: 2rem;
    }
    
    .post-content h2 {
        font-size: 1.75rem;
    }
    
    .post-content h3 {
        font-size: 1.5rem;
    }
    
    .post-content ul,
    .post-content ol {
        padding-right: 1.5rem;
    }
    
    .post-content blockquote {
        padding: 1rem;
        margin: 1.5rem 0;
    }
    
    /* Mobile TOC adjustments */
    .article-toc {
        margin: 1rem 0; /* Reduced from 1.5rem */
        padding: 0.75rem; /* Reduced from 1rem */
    }
    
    .toc-title {
        font-size: 1.1rem;
    }
    
    .toc-header {
        margin-bottom: 0.5rem; /* Reduced spacing */
    }
    
    .toc-item {
        margin: 0.2rem 0; /* Reduced from default */
    }
    
    .toc-link {
        padding: 0.25rem 0.4rem; /* More compact on mobile */
        font-size: 0.9rem;
    }
    
    /* Reduced mobile hierarchy indentation */
    .toc-h2 { margin-right: 0.4rem; } /* Reduced from 0.5rem */
    .toc-h3 { margin-right: 0.8rem; } /* Reduced from 1rem */
    .toc-h4 { margin-right: 1.2rem; } /* Reduced from 1.5rem */
    .toc-h5 { margin-right: 1.6rem; } /* Reduced from 2rem */
    .toc-h6 { margin-right: 2rem; } /* Reduced from 2.5rem */
    
    /* Mobile heading link adjustments */
    .heading-link {
        right: -1.5rem;
        font-size: 0.7em;
    }
    
    /* Mobile sidebar adjustments */
    .article-sidebar {
        margin-bottom: 1.5rem;
    }
    
    .sidebar-header {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .sidebar-content {
        padding: 1rem;
    }
}

/* Large screen enhancements */
@media (min-width: 1024px) {
    .post-content h2::before {
        margin-right: -1.5rem;
    }
}

/* Print styles */
@media print {
    .article-toc,
    .article-sidebar,
    .heading-link {
        display: none !important;
    }
    
    .post-content {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
    }
    
    .post-content h1,
    .post-content h2,
    .post-content h3 {
        page-break-after: avoid;
        color: black;
    }
    
    .post-content img {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    .post-content blockquote {
        border-right: 2px solid black;
        background: none;
    }
}

/* Additional Blog Styling Utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Table of Contents Styling */
.article-toc {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #349FA5;
    border-radius: 12px;
    padding: 1rem; /* Reduced from 1.5rem */
    margin: 1.5rem 0; /* Reduced from 2rem */
    box-shadow: 0 4px 12px rgba(52, 159, 165, 0.1);
    position: relative;
    overflow: hidden;
}

.article-toc::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #349FA5, #8A1538);
}

.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem; /* Reduced from 1rem */
    cursor: pointer;
    user-select: none;
}

.toc-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #8A1538;
    display: flex;
    align-items: center;
    gap: 0.25rem; /* Reduced from 0.5rem */
}

.toc-title::before {
    content: "📋";
    font-size: 1.1rem; /* Reduced from 1.2rem */
}

.toc-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #349FA5;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 0.25rem;
    border-radius: 4px;
}

.toc-toggle:hover {
    background-color: rgba(52, 159, 165, 0.1);
}

.toc-toggle.collapsed {
    transform: rotate(180deg);
}

.toc-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.toc-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin: 0.25rem 0; /* Reduced from 0.5rem */
}

.toc-link {
    display: block;
    padding: 0.35rem 0.5rem; /* Reduced from 0.5rem 0.75rem */
    color: #444;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
    font-weight: 500;
    line-height: 1.3; /* Added for better text alignment */
}

.toc-link:hover {
    background-color: rgba(52, 159, 165, 0.1);
    color: #8A1538;
    border-right-color: #349FA5;
    transform: translateX(-2px);
}

.toc-link.active {
    background-color: rgba(138, 21, 56, 0.1);
    color: #8A1538;
    border-right-color: #8A1538;
}

/* TOC Hierarchy Styling - Reduced indentation */
.toc-h1 { font-size: 1rem; margin-right: 0; }
.toc-h2 { font-size: 0.95rem; margin-right: 0.75rem; } /* Reduced from 1rem */
.toc-h3 { font-size: 0.9rem; margin-right: 1.5rem; } /* Reduced from 2rem */
.toc-h4 { font-size: 0.85rem; margin-right: 2.25rem; } /* Reduced from 3rem */
.toc-h5 { font-size: 0.8rem; margin-right: 3rem; } /* Reduced from 4rem */
.toc-h6 { font-size: 0.75rem; margin-right: 3.75rem; } /* Reduced from 5rem */

/* Heading Hover Link Icons */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    position: relative;
    scroll-margin-top: 2rem;
}

.post-content h1:hover .heading-link,
.post-content h2:hover .heading-link,
.post-content h3:hover .heading-link,
.post-content h4:hover .heading-link,
.post-content h5:hover .heading-link,
.post-content h6:hover .heading-link {
    opacity: 1;
    visibility: visible;
}

.heading-link {
    position: absolute;
    right: -2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    color: #349FA5;
    text-decoration: none;
    font-size: 0.8em;
    padding: 0.25rem;
    border-radius: 4px;
}

.heading-link:hover {
    background-color: rgba(52, 159, 165, 0.1);
    color: #8A1538;
}

/* Sidebar Styling */
.article-sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.sidebar-section {
    border-bottom: 1px solid #eee;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-header {
    background: linear-gradient(135deg, #8A1538, #7A0A2C);
    color: white;
    padding: 1rem 1.5rem;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-content {
    padding: 1.5rem;
}

.sidebar-search input {
    flex: 1;
    padding: 0.625rem 2.5rem 0.625rem 1rem; /* Adjusted for flex layout */
    border: 2px solid #e9ecef;
    border-radius: 0.5rem 0 0 0.5rem; /* Right rounded corners only */
    font-size: 1rem;
    transition: border-color 0.3s ease;
    direction: rtl;
    text-align: right;
    border-left: none; /* Remove left border to connect with button */
}

.sidebar-search input:focus {
    outline: none;
    border-color: #349FA5;
    box-shadow: 0 0 0 3px rgba(52, 159, 165, 0.1);
}

.sidebar-search input::placeholder {
    color: #9ca3af;
    text-align: right;
}

/* Search form flex layout */
.sidebar-search form.flex {
    display: flex;
    align-items: stretch;
}

.sidebar-search .flex-1 {
    flex: 1;
    position: relative;
}

/* Search button styling */
.sidebar-search button[type="submit"]:not(.absolute) {
    background: #8A1538;
    color: white;
    border: 2px solid #8A1538;
    padding: 0.625rem 1rem;
    border-radius: 0 0.5rem 0.5rem 0; /* Left rounded corners only */
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.875rem;
    border-right: none; /* Remove right border to connect with input */
}

.sidebar-search button[type="submit"]:not(.absolute):hover {
    background: #7A0A2C;
    border-color: #7A0A2C;
}

/* Icon button inside input */
.sidebar-search button[type="submit"].absolute {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

.sidebar-search button[type="submit"].absolute:hover {
    color: #349FA5;
}

/* Search Results Page Styling */
.search-results {
    direction: rtl;
}

.search-results mark {
    background-color: #fef3c7;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 600;
    color: #8A1538;
}

.search-results .search-form {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #349FA5;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-results .search-form input[type="search"] {
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.75rem 3rem 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    direction: rtl;
    text-align: right;
}

.search-results .search-form input[type="search"]:focus {
    outline: none;
    border-color: #349FA5;
    box-shadow: 0 0 0 3px rgba(52, 159, 165, 0.1);
}

.search-results .search-form button {
    transition: all 0.3s ease;
}

.search-results .search-form button:hover {
    background-color: #7A0A2C;
    transform: translateY(-1px);
}

/* Search result items */
.search-result-item {
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.search-result-item:hover {
    border-left-color: #349FA5;
    transform: translateX(-2px);
}

/* Line clamp utility for search results */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* No results styling */
.no-results {
    text-align: center;
    color: #6b7280;
}

.no-results svg {
    opacity: 0.5;
}

/* Enhanced search form styling */
.search-form.focused,
.sidebar-search.focused {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.search-form input.has-query,
.sidebar-search input.has-query {
    border-color: #349FA5;
    background-color: #f0fdf4;
}

/* Search button hover effects */
.search-form button[type="submit"]:hover svg,
.sidebar-search button[type="submit"]:hover svg {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Search input animations */
.search-form input[type="search"],
.sidebar-search input[type="search"] {
    transition: all 0.3s ease;
}

.search-form input[type="search"]:focus,
.sidebar-search input[type="search"]:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 159, 165, 0.15);
}

/* Search placeholder styling */
.search-form input[type="search"]::placeholder,
.sidebar-search input[type="search"]::placeholder {
    color: #9ca3af;
    font-style: italic;
    transition: color 0.3s ease;
}

.search-form input[type="search"]:focus::placeholder,
.sidebar-search input[type="search"]:focus::placeholder {
    color: #d1d5db;
}

/* Responsive search form with mobile-first approach */
@media (max-width: 480px) {
    /* Mobile-first breakpoint for small screens */
    .search-form {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border: 2px solid #349FA5;
        border-radius: 16px;
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .search-form .flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-form input[type="search"] {
        border-radius: 12px;
        padding: 1rem 3.5rem 1rem 1rem;
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 48px; /* Better touch target */
        border: 2px solid #d1d5db;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .search-form input[type="search"]:focus {
        border-color: #349FA5;
        box-shadow: 0 0 0 4px rgba(52, 159, 165, 0.15), 0 4px 12px rgba(0,0,0,0.1);
        transform: translateY(-2px);
    }
    
    .search-form button {
        border-radius: 12px;
        padding: 1rem 2rem;
        font-size: 16px;
        font-weight: 600;
        min-height: 48px;
        background: linear-gradient(135deg, #8A1538, #7A0A2C);
        box-shadow: 0 4px 12px rgba(138, 21, 56, 0.3);
        transform: translateY(0);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .search-form button:hover,
    .search-form button:active {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(138, 21, 56, 0.4);
    }
    
    /* Mobile sidebar search optimizations */
    .sidebar-search {
        background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
        border-radius: 12px;
        padding: 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    .sidebar-search form.flex {
        gap: 0.5rem;
    }
    
    .sidebar-search input {
        padding: 0.875rem 3rem 0.875rem 1rem;
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 44px;
        border-radius: 10px 0 0 10px;
        border: 2px solid #e5e7eb;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar-search input:focus {
        border-color: #349FA5;
        box-shadow: 0 0 0 3px rgba(52, 159, 165, 0.15);
        transform: translateY(-1px);
    }
    
    .sidebar-search button[type="submit"]:not(.absolute) {
        padding: 0.875rem 1.25rem;
        min-height: 44px;
        border-radius: 0 10px 10px 0;
        font-size: 14px;
        font-weight: 600;
        background: linear-gradient(135deg, #8A1538, #7A0A2C);
        box-shadow: 0 2px 8px rgba(138, 21, 56, 0.25);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar-search button[type="submit"]:not(.absolute):active {
        transform: translateY(1px);
        box-shadow: 0 1px 4px rgba(138, 21, 56, 0.3);
    }
    
    /* Enhanced icon button for mobile */
    .sidebar-search button[type="submit"].absolute {
        left: 0.75rem;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: rgba(52, 159, 165, 0.1);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar-search button[type="submit"].absolute:active {
        background: rgba(52, 159, 165, 0.2);
        transform: translateY(-50%) scale(0.95);
    }
    
    /* Mobile-optimized article layout */
    .lg\:col-span-3, .lg\:col-span-1 {
        grid-column: span 1;
    }
    
    .article-sidebar {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }
    
    .sidebar-header {
        padding: 1rem 1.25rem;
        background: linear-gradient(135deg, #8A1538, #7A0A2C);
    }
    
    .sidebar-content {
        padding: 1.25rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    /* Tablet optimizations */
    .search-form {
        padding: 1.5rem;
        border-radius: 14px;
    }
    
    .search-form .flex {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .search-form input[type="search"] {
        padding: 0.875rem 3rem 0.875rem 1rem;
        border-radius: 10px 0 0 10px;
        font-size: 16px;
        min-height: 46px;
    }
    
    .search-form button {
        padding: 0.875rem 1.5rem;
        border-radius: 0 10px 10px 0;
        min-height: 46px;
        font-size: 15px;
    }
    
    .sidebar-search input {
        padding: 0.75rem 2.75rem 0.75rem 1rem;
        font-size: 15px;
        min-height: 42px;
    }
    
    .sidebar-search button[type="submit"]:not(.absolute) {
        padding: 0.75rem 1rem;
        min-height: 42px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    /* General mobile improvements */
    
    /* Enhanced touch targets */
    a, button, input, textarea, select {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    /* Prevent iOS zoom on inputs */
    input[type="search"],
    input[type="text"],
    input[type="email"],
    textarea {
        font-size: 16px !important;
        -webkit-appearance: none;
        appearance: none;
        -webkit-border-radius: 0;
        border-radius: 0;
    }
    
    /* Mobile performance optimizations */
    * {
        -webkit-tap-highlight-color: rgba(52, 159, 165, 0.2);
        tap-highlight-color: rgba(52, 159, 165, 0.2);
    }
    
    /* Smooth scrolling on mobile */
    html {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* GPU acceleration for animations */
    .search-form,
    .sidebar-search,
    .search-result-item,
    .blog-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Mobile-optimized spacing */
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .py-16 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    /* Search results mobile optimization */
    .search-result-item {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .search-result-item:active {
        transform: translateY(1px);
        box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    }
    
    /* Mobile typography improvements */
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    /* Mobile sidebar improvements */
    .sidebar-categories a,
    .sidebar-recent a {
        padding: 0.75rem 1rem;
        border-radius: 8px;
        min-height: 44px;
        display: flex;
        align-items: center;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar-categories a:active,
    .sidebar-recent a:active {
        transform: translateX(-4px) scale(0.98);
        background-color: rgba(52, 159, 165, 0.15);
    }
    
    /* Mobile pagination */
    .pagination a,
    .pagination span {
        padding: 0.75rem 1rem;
        min-height: 44px;
        border-radius: 8px;
        margin: 0 0.25rem;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .pagination a:active {
        transform: translateY(1px);
    }
}

.sidebar-categories ul,
.sidebar-recent ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-categories li,
.sidebar-recent li {
    margin-bottom: 0.75rem;
}

.sidebar-categories a,
.sidebar-recent a {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    color: #444;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.sidebar-categories a:hover,
.sidebar-recent a:hover {
    background-color: rgba(52, 159, 165, 0.1);
    color: #8A1538;
    transform: translateX(-2px);
}

.sidebar-categories a::before {
    content: "📁";
    margin-left: 0.5rem;
}

.sidebar-recent a::before {
    content: "📄";
    margin-left: 0.5rem;
}

.category-count {
    background: #349FA5;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    margin-right: auto;
}

.recent-date {
    font-size: 0.75rem;
    color: #666;
    margin-right: auto;
}

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background-color: #8A1538;
    color: white;
    border-color: #8A1538;
}

.pagination .current {
    background-color: #8A1538;
    color: white;
    border-color: #8A1538;
}

/* Blog Card Enhancements */
.blog-card {
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.blog-card:hover {
    transform: translateY(-5px);
    border-color: #349FA5;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Enhanced Typography for Arabic Content */
.post-content {
    text-align: justify;
    direction: rtl;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    direction: rtl;
    text-align: right;
}

/* Print Styles */
@media print {
    .post-content {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
    }
    
    .post-content h1,
    .post-content h2,
    .post-content h3 {
        page-break-after: avoid;
        color: black;
    }
    
    .post-content img {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    .post-content blockquote {
        border-right: 2px solid black;
        background: none;
    }
}