/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-light: #f9fafb;
    --bg-dark: #111827;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-light);
    line-height: 1.6;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 3rem 0;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Navigation */
.main-nav {
    background: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

#searchInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    transition: var(--transition);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#searchBtn {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

#searchBtn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}


/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 400px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 200px;
}

.sidebar h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

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

.category-list li {
    margin-bottom: 0.5rem;
}

.category-list a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.category-list a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
    padding-right: 1rem;
}

/* Glossary Content */
.glossary-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.intro {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.intro h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.intro p {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Term Cards */
.term-card {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 10px;
    border-right: 4px solid var(--primary-color);
    transition: var(--transition);
}

.term-card:hover {
    box-shadow: var(--shadow);
    transform: translateX(-5px);
}

.term-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.term-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.term-english {
    font-size: 1rem;
    color: var(--text-light);
    font-style: italic;
    font-weight: 400;
}

.term-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.term-definition {
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.term-formula {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    direction: ltr;
    text-align: center;
    overflow-x: auto;
}

.term-formula strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    direction: rtl;
    text-align: right;
}

.formula-content {
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.term-formula .MathJax {
    font-size: 1.1rem !important;
}

.term-example {
    background: #fef3c7;
    border-right: 3px solid #f59e0b;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.term-example strong {
    color: #92400e;
    display: block;
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    background: var(--bg-dark);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer p {
    margin-bottom: 0.5rem;
}

/* Search Results */
.search-results {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #dbeafe;
    border-radius: 8px;
    border-right: 4px solid var(--primary-color);
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 968px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 640px) {
    .search-box {
        flex-direction: column;
    }

    #searchBtn {
        width: 100%;
    }

    .alphabet-nav {
        gap: 0.25rem;
    }

    .alphabet-nav a {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    .term-header {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .main-nav,
    .sidebar,
    footer {
        display: none;
    }

    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .term-card {
        page-break-inside: avoid;
    }
}

