* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Header Styles */
.top-header {
    background-color: var(--bg-color);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 99;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    
    margin: 0 auto;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.top-nav ul {
    list-style: none;
    display: flex;
}

.top-nav li {
    margin-left: 1rem;
    font-weight: bold;
}

.top-nav a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.top-nav a:hover {
    color: var(--accent-color);
}

.top-nav a.active {
    font-weight: 500;
    color: var(--accent-color);
}

.header-theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative; /* Add this */
    overflow: hidden; /* Add this */
    display: flex; /* Add this */
    align-items: center; /* Add this */
    justify-content: center; /* Add this */
}

.header-theme-toggle i {
    font-size: 1.2rem;
    position: absolute; /* Add this */
    transition: opacity 0.3s ease; /* Add this */
}



body[data-theme="dark"] .header-theme-toggle .sun-icon {
    opacity: 1; /* Show sun icon in dark mode */
}

body[data-theme="light"] .header-theme-toggle .moon-icon {
    opacity: 1; /* Show moon icon in light mode */
}



.header-theme-toggle:hover {
    background: var(--hover-color);
}

.header-theme-toggle i {
    font-size: 1.2rem;
}

.container {
    display: flex;
	justify-content:center;
}

/* Sidebar Styles */
.sidebar {
	top:0px!important;
    width: 280px;
    /* The background is now correctly handled by theme.css using variables */
    border-left: 1px solid var(--border-color);
    height: 100vh;
    overflow-y: auto;
    padding: 1rem;
    box-shadow: 2px 0 10px var(--shadow-color);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    position: relative;
}

.nav-link:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

.nav-link.active {
    background-color: var(--hover-color);
    color: var(--accent-color);
    font-weight: 500;
}

/* Submenu Styles */
/* Base submenu styles */
.submenu {
    /* display is now handled by JS to prevent conflicts */
    overflow: hidden; /* Crucial for height animation */
    list-style: none;
    margin-right: 1.5rem;
    padding-right: 1rem;
    border-right: 2px solid transparent;
    background-color: transparent;
    margin-top: 0.25rem;
}

/* Active state for all submenus */
.has-submenu.active > .submenu {
    /* display: block; /* This is now handled by JS */
    border-right-color: var(--accent-color);
    background-color: var(--hover-color);
}

/* Styling for all links inside any submenu */
.submenu a {
    display: block;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}

.submenu a:hover {
    color: var(--accent-color);
    transform: translateX(-4px);
    background-color: rgba(0,0,0,0.04);
}

[data-theme="dark"] .submenu a:hover {
    background-color: rgba(255,255,255,0.04);
}

.has-submenu > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0.8rem 1rem;
}

/* .has-submenu > a::after {
    content: '◂';
    font-size: 1.2em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--accent-color);
    opacity: 0.7;
    margin-right: 0.5rem;
    display: inline-block;
    transform-origin: center;
    font-weight: bold;
} */

.has-submenu.active > a::after {
    transform: rotate(-90deg);
    opacity: 1;
}

.submenu li {
    margin-bottom: 0.25rem;
}

.submenu a {
    display: block;
    color: var(--submenu-text-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin: 0.1rem 0;
    position: relative;
    overflow: hidden;
}

.submenu a:hover {
    color: var(--accent-color);
    background-color: var(--slate-600);
    transform: translateX(-4px);
}

/* Nested Submenu Styles */
.submenu .has-submenu {
    margin-right: 0;
}

.submenu .has-submenu > a {
    font-weight: 500;
    /* Re-apply flex to align icon, but padding is inherited for consistency */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* .submenu .has-submenu > a::after {
    content: '◂';
    font-size: 1.1em;
    color: var(--accent-color);
    margin-right: 0.5rem;
    transform-origin: center;
    font-weight: bold;
} */

.submenu .has-submenu.active > a {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

.submenu .has-submenu.active > a::after {
    transform: rotate(-90deg);
}

/* Second level submenu */
.submenu .submenu {
    margin-right: 1rem;
    padding-right: 0.5rem;
    border-right-width: 1px;
    border-right-color: var(--border-color);
    margin-top: 0.25rem;
}

/* Second level submenu links */
.submenu .submenu a {
    padding: 0.5rem ;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.9;
    position: relative;
    display: flex;
    align-items: center;
}



/* Third level submenu */
.submenu .submenu .submenu {
    margin-right: 0.8rem;
    padding-right: 0.4rem;
}

/* Third level submenu links */
.submenu .submenu .submenu a {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.submenu .submenu .submenu a::before {
    font-size: 0.9rem;
}

.submenu .submenu a:hover {
    color: var(--accent-color);
    opacity: 1;
    transform: translateX(-4px);
}

.submenu .submenu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 102, 204, 0.08));
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.submenu .submenu a:hover::after {
    transform: translateX(-100%);
}

/* Hover effects for submenu items with icons */
.submenu a:hover::before {
    opacity: 1;
}

/* Active submenu headers */
.has-submenu.active > a {
    color: var(--accent-color);
    background-color: var(--hover-color);
}

/* Improved hover effects for nested items */
.submenu .has-submenu:hover > a {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* Better spacing and alignment */
.nav-item .has-submenu {
    margin-bottom: 0.3rem;
}

.submenu .has-submenu {
    margin-bottom: 0.2rem;
}

/* Content Styles */
.content {
	width:100%!important;
    flex: 1;
    padding-inline: 2rem;
}

@media (max-width: 991.98px) {
  .content {
    width: 100% !important;
    margin: 0 !important;
    margin-right: 0 !important;
    margin-inline-end: 0 !important;
    padding: 2rem 1rem;
  }
}



.content-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d3748 50%, #4a5568 100%);
    color: white;
    padding: 4rem 3rem;
    border-radius: 12px;
    margin-bottom: 3rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.content-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.03)"/><circle cx="20" cy="80" r="0.5" fill="rgba(255,255,255,0.03)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.search-container {
    margin-top: 2rem;
    position: relative;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-box input:focus {
outline: none;
}

.search-button {
background: transparent;
border: none;
color: white;
padding: 0.5rem 1rem;
cursor: pointer;
transition: transform 0.2s ease;
}

.search-button:hover {
transform: scale(1.1);
}

.search-button i {
    font-size: 1.2rem;
    opacity: 0.8;
}

.content-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.content-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Quick Links Section */
.quick-links {
    margin-bottom: 3rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    background-color: #f0f0f0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), #4d94ff);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Features Section */


.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-item {
    background-color: #f0f0f0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.feature-item h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Section Headers */
h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

/* Documentation Content Styles */
.documentation-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 0;
}

.content-section {
    margin-bottom: 3rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
   
    padding-inline: 2rem;
}

.content-section h2 {
    color: var(--primary-color);
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    position: relative;
    margin-top: 3rem;
}

.content-section h2::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    right: 0;
    width: 50px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
}

.content-section p {
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

/* Code Block Styling */
.code-block {
    background: #1e1e1e;
    border: 2px solid #333;
    border-radius: 12px;
    margin: 2rem 1rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    width: calc(100% - 2rem);
    max-width: calc(100% - 2rem);
    position: relative;
}

.code-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007acc, #00d4ff, #007acc);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: -200% 0; }
}

.code-header {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #e0e0e0;
    direction: rtl;
    text-align: right;
}

.code-language {
    font-weight: 600;
    color: #00d4ff;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-language::before {
    content: '●';
    color: #00ff88;
    font-size: 1.2rem;
}

.code-copy {
    background: linear-gradient(135deg, #007acc, #005a9e);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 122, 204, 0.3);
    font-family: inherit;
}

.code-copy:hover {
    background: linear-gradient(135deg, #0088ff, #0066cc);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.4);
}

.code-copy:active {
    transform: translateY(0);
}

.code-content {
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'Fira Code', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #e0e0e0;
    direction: ltr;
    text-align: left;
    background: #1e1e1e;
    min-height: 60px;
    width: 100%;
    box-sizing: border-box;
}

.code-content pre {
    margin: 0;
    white-space: pre;
    direction: ltr;
    text-align: left;
    width: 100%;
    overflow-x: auto;
    padding: 0;
}

.code-content::-webkit-scrollbar {
    height: 8px;
}

.code-content::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.code-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.code-content::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Enhanced Inline Code */
code {
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-family: 'Fira Code', 'SF Mono', 'Monaco', monospace;
    font-size: 0.85em;
    color: #00d4ff;
    direction: ltr;
    unicode-bidi: bidi-override;
    text-align: left;
    display: inline-block;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Syntax highlighting */
.keyword { color: #ff79c6; font-weight: 600; }
.string { color: #f1fa8c; }
.comment { color: #6272a4; font-style: italic; }
.function { color: #50fa7b; font-weight: 600; }
.number { color: #bd93f9; }
.operator { color: #ff79c6; }
.variable { color: #f8f8f2; }

/* Danger Zone Styling */
.danger-zone {
    background: var(--danger-bg);
    border: 2px solid var(--danger-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.danger-zone::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--danger-icon), #fc8181);
}

.danger-zone-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--danger-text);
}

.danger-zone-header i {
    font-size: 1.5rem;
    margin-left: 0.75rem;
    color: var(--danger-icon);
}

.danger-zone-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.danger-zone-content {
    color: var(--danger-text);
    line-height: 1.6;
}

.danger-zone-content p {
    margin-bottom: 1rem;
}

.danger-zone-content ul {
    margin-right: 1.5rem;
}

.danger-zone-content li {
    margin-bottom: 0.5rem;
}

/* Notification Zone Styling */
.notification-zone {
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.notification-zone.info {
    background: var(--info-bg);
    border: 2px solid var(--info-border);
}

.notification-zone.success {
    background: var(--success-bg);
    border: 2px solid var(--success-border);
}

.notification-zone.warning {
    background: var(--warning-bg);
    border: 2px solid var(--warning-border);
}

.notification-zone::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
}

.notification-zone.info::before {
    background: linear-gradient(90deg, var(--info-icon), #63b3ed);
}

.notification-zone.success::before {
    background: linear-gradient(90deg, var(--success-icon), #68d391);
}

.notification-zone.warning::before {
    background: linear-gradient(90deg, var(--warning-icon), #f6e05e);
}

.notification-zone-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.notification-zone.info .notification-zone-header {
    color: var(--info-text);
}

.notification-zone.success .notification-zone-header {
    color: var(--success-text);
}

.notification-zone.warning .notification-zone-header {
    color: var(--warning-text);
}

.notification-zone-header i {
    font-size: 1.5rem;
    margin-left: 0.75rem;
}

.notification-zone.info .notification-zone-header i {
    color: var(--info-icon);
}

.notification-zone.success .notification-zone-header i {
    color: var(--success-icon);
}

.notification-zone.warning .notification-zone-header i {
    color: var(--warning-icon);
}

.notification-zone-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.notification-zone-content {
    line-height: 1.6;
}

.notification-zone.info .notification-zone-content {
    color: var(--info-text);
}

.notification-zone.success .notification-zone-content {
    color: var(--success-text);
}

.notification-zone.warning .notification-zone-content {
    color: var(--warning-text);
}

.notification-zone-content p {
    margin-bottom: 1rem;
}

.notification-zone-content ul {
    margin-right: 1.5rem;
}

.notification-zone-content li {
    margin-bottom: 0.5rem;
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.search-results.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.search-results-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-height: 500px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-results-container::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: white;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

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

.results-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.close-search {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s ease;
}

.close-search:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.results-list {
    padding: 1rem;
    overflow-y: auto;
    max-height: 400px;
}

.result-item {
    display: flex;
    padding: 1.25rem;
    border-radius: 8px;
    margin: 0.5rem;
    transition: all 0.3s ease;
    background: rgb(70, 80, 96);
    border: 1px solid transparent;
}

.result-item:hover {
    
    transform: translateX(-4px);
    border-color: var(--accent-color);
}

.result-item:active {
    transform: translateX(-2px);
}

.result-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}