@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: #f8f9fa;
    color: #2c3e50;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: 350px;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    padding: 2rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f3f4;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 3px;
}

.logo {
    text-align: center;
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.logo h1 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo p {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 400;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.75rem;
    opacity: 0;
    animation: slideInRight 0.6s ease forwards;
}

.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.2s; }
.nav-item:nth-child(3) { animation-delay: 0.3s; }
.nav-item:nth-child(4) { animation-delay: 0.4s; }
.nav-item:nth-child(5) { animation-delay: 0.5s; }
.nav-item:nth-child(6) { animation-delay: 0.6s; }
.nav-item:nth-child(7) { animation-delay: 0.7s; }

.nav-link {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: #495057;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    border: 1px solid transparent;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    gap: 12px;
}

.nav-link:hover {
    background: #f8f9fa;
    color: #212529;
    border-color: #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link.active {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #1976d2;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.15);
}

.nav-icon {
    font-size: 16px;
    min-width: 20px;
    color: #6c757d;
    flex-shrink: 0;
}

.nav-link.active .nav-icon {
    color: #1565c0;
}

.chapter-number {
    background: #6c757d;
    color: white;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link.active .chapter-number {
    background: #1976d2;
}

.nav-link span:not(.chapter-number):not(.nav-icon) {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-right: 350px;
    padding: 3rem;
    background: #ffffff;
    min-height: 100vh;
}

/* ============ LOADING ============ */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============ CONTENT SECTIONS ============ */
.content-section {
    opacity: 0;
    animation: fadeIn 0.4s ease-in-out forwards;
}

.section-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid #e9ecef;
    opacity: 0;
    animation: slideInUp 0.6s ease forwards;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 400;
}

/* ============ CONTENT CARDS ============ */
.content-card {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s ease forwards;
}

.content-card:nth-child(1) { animation-delay: 0.1s; }
.content-card:nth-child(2) { animation-delay: 0.2s; }
.content-card:nth-child(3) { animation-delay: 0.3s; }
.content-card:nth-child(4) { animation-delay: 0.4s; }
.content-card:nth-child(5) { animation-delay: 0.5s; }

.content-card:hover {
    border-color: #dee2e6;
    background: #fafafa;
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f3f4;
}

.card-icon {
    font-size: 1.4rem;
    margin-left: 12px;
    color: #6c757d !important;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
}

.card-content {
    font-size: 1rem;
    color: #495057;
    line-height: 1.7;
}

.card-content h3 {
    color: #1976d2;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.card-content p {
    margin-bottom: 1rem;
}

.card-content ul {
    margin: 1rem 0;
}

.card-content li {
    margin-bottom: 0.5rem;
    color: #495057;
}

/* ============ SPECIAL ELEMENTS ============ */
.highlight-box {
    background: #f8f9fa;
    border: 2px solid #1976d2;
    border-radius: 4px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-right: 6px solid #1976d2;
}

.highlight-box strong {
    color: #1565c0;
    font-weight: 600;
}

.code-block {
    background: #2f3349;
    color: #ffffff;
    border: 1px solid #495057;
    border-radius: 4px;
    padding: 1.5rem;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    position: relative;
    line-height: 1.5;
}

.copy-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #495057;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #6c757d;
}

/* ============ FEATURE GRID ============ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.feature-item:hover {
    background: #ffffff;
    border-color: #dee2e6;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.feature-desc {
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ============ MOBILE RESPONSIVE ============ */
.mobile-menu {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 4px;
    width: 45px;
    height: 45px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-menu:hover {
    background: #1565c0;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(100%);
        z-index: 1000;
        border-left: none;
        border-bottom: 2px solid #e9ecef;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        padding: 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .mobile-menu {
        display: block !important;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .content-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }

    .content-card {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .card-title {
        font-size: 1.1rem;
    }
}

/* ============ ERROR STATES ============ */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
    padding: 2rem;
}

.error-icon {
    font-size: 3rem;
    color: #dc3545;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.2rem;
    color: #495057;
    margin-bottom: 2rem;
    font-weight: 500;
}

.retry-btn {
    background: #1976d2;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.retry-btn:hover {
    background: #1565c0;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInRight {
    from { 
        opacity: 0; 
        transform: translateX(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

/* ============ FOCUS STYLES ============ */
.nav-link:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.copy-btn:focus {
    outline: 2px solid #28a745;
    outline-offset: 1px;
}

.retry-btn:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* ============ PRINT STYLES ============ */
@media print {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-right: 0;
        padding: 1rem;
    }
    
    .content-card {
        border: 1px solid #000;
        margin-bottom: 1rem;
        break-inside: avoid;
    }
    
    .mobile-menu {
        display: none;
    }
}

/* ============ CUSTOM SCROLLBARS ============ */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: #f1f3f4;
}

.main-content::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #495057;
}

/* ============ TABLE STYLES ============ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    padding: 12px;
    text-align: right;
    border: 1px solid #dee2e6;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #1f2937;
}

tr:nth-child(even) {
    background: #f8f9fa;
}

/* ============ BLOCKQUOTE STYLES ============ */
/* ============ UTILITY CLASSES ============ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.font-bold { font-weight: 600; }
.font-normal { font-weight: 400; }

.text-primary { color: #1976d2; }
.text-secondary { color: #6c757d; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }

/* ============ HELPER CLASSES ============ */
.hidden { display: none; }
.visible { display: block; }

.rounded { border-radius: 4px; }
.rounded-lg { border-radius: 6px; }

.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.shadow { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 4px 8px rgba(0,0,0,0.15); }X(0);
    }

    .main-content {
        margin-right: 0;
        padding: 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .mobile-menu {
        display: block !important;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }

    .content-card {
        padding: 1.5rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .card-title {
        font-size: 1.2rem;
    }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInRight {
    from { 
        opacity: 0; 
        transform: translateX(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); 
    }
}

/* ============ CUSTOM SCROLLBARS ============ */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.5);
}

.main-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #10b981);
    border-radius: 10px;
}

/* ============ ERROR STATES ============ */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.2rem;
    color: #94a3b8;
    margin-bottom: 2rem;
}

.retry-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}