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

:root {
    --primary: #0A0A0A;
    --primary-dark: #000000;
    --primary-light: #F0F0F0;
    --success: #10B981;
    --success-light: #D1FAE5;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    font-size: 14px;
}

button,
input,
select,
textarea,
.admin-btn,
.product-link,
.platform-shortcuts a {
    font-family: inherit;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 32px;
    display: flex;
    align-items: center;
    gap: 42px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

a.logo-section {
    text-decoration: none;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.logo-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
    margin-bottom: 8px;
}

.logo-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1;
}

/* Search */
.search-wrapper {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.search-input:focus {
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 500px;
    overflow-y: auto;
    display: none;
    border: 1px solid var(--gray-200);
    z-index: 1000;
}

.search-results.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--gray-900);
}

.search-result-excerpt {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

.search-highlight {
    background: #FEF3C7;
    color: #92400E;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.no-results {
    padding: 32px 20px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

/* Admin Button */
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.admin-btn svg {
    width: 16px;
    height: 16px;
}

.admin-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px 0;
}

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

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    font-size: 13px;
}

.breadcrumb svg {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    transform: rotateY(180deg);
}

.breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--primary);
}

.breadcrumb span {
    color: var(--gray-500);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.page-description {
    font-size: 14px;
    color: var(--gray-500);
}

.count-badge {
    display: inline-block;
    padding: 8px 16px;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

/* Questions Grid */
.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.question-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.question-card:nth-child(1) {
    animation-delay: 0.05s;
}

.question-card:nth-child(2) {
    animation-delay: 0.1s;
}

.question-card:nth-child(3) {
    animation-delay: 0.15s;
}

.question-card:nth-child(4) {
    animation-delay: 0.2s;
}

.question-card:nth-child(5) {
    animation-delay: 0.25s;
}

.question-card:nth-child(6) {
    animation-delay: 0.3s;
}

.question-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-excerpt {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.views-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-500);
}

.views-badge svg {
    width: 14px;
    height: 14px;
    color: var(--gray-400);
}

.answered-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--success-light);
    color: #065F46;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.answered-badge svg {
    width: 12px;
    height: 12px;
}

/* Question Detail */
.question-detail {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 40px;
    animation: fadeIn 0.5s ease;
}

.question-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.question-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 16px;
    line-height: 1.3;
}

.question-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-600);
}

.meta-item svg {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

/* Content Section */
.content-section {
    margin-bottom: 32px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-header svg {
    width: 20px;
    height: 20px;
    color: var(--gray-500);
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.answer-header svg {
    color: var(--success);
}

.content-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
    line-height: 1.8;
    color: var(--gray-700);
}

.answer-box {
    background: var(--success-light);
    border-color: #A7F3D0;
}

.content-box p {
    margin-bottom: 16px;
}

.content-box p:last-child {
    margin-bottom: 0;
}

.content-box ul,
.content-box ol {
    margin: 16px 0 16px 24px;
}

.content-box li {
    margin-bottom: 8px;
}

.content-box img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    display: block;
}

.content-box pre {
    background: var(--gray-900);
    color: #F3F4F6;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    font-size: 13px;
    line-height: 1.6;
}

.content-box code {
    background: var(--gray-200);
    color: var(--gray-800);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.content-box pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.content-box a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.content-box a:hover {
    text-decoration: underline;
}

.content-box blockquote {
    border-right: 3px solid var(--primary);
    padding-right: 16px;
    margin: 16px 0;
    color: var(--gray-600);
    font-style: italic;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--gray-500);
}

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 24px 0;
    margin-top: 80px;
}

.footer p {
    text-align: center;
    color: var(--gray-500);
    font-size: 13px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

/* Responsive */
@media (max-width: 1024px) {
    .questions-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        padding: 16px 20px;
        gap: 16px;
    }

    .logo-section {
        width: 100%;
    }

    .search-wrapper {
        order: 3;
        width: 100%;
    }

    .admin-btn {
        margin-right: auto;
    }

    .container {
        padding: 0 20px;
    }

    .main-content {
        padding: 24px 0;
    }

    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .page-title {
        font-size: 24px;
    }

    .questions-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .question-detail {
        padding: 24px;
        border-radius: 12px;
    }

    .question-title {
        font-size: 24px;
    }

    .question-meta {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .logo-title {
        font-size: 16px;
    }

    .question-card {
        padding: 20px;
    }

    .card-title {
        font-size: 15px;
    }

    .question-detail {
        padding: 20px;
    }

    .question-title {
        font-size: 20px;
    }
}

.question-meta {
    display: none !important;
}

.card-footer {
    display: none !important;
}

.page-notification {
    margin-bottom: 35px;
    padding: 10px 15px;
    border: 1px dashed #a88f03;
    border-radius: 10px;
    background: #ccad0314;
    color: #a88f03;
}

.page-notification.info {
    border-color: #666;
    background: #66666614;
    color: #444;
}

.page-notification + .page-notification {
    margin-top: -20px;
    /* تنگ‌تر کردن فاصله دو اعلان پشت‌سرهم */
}

/* ===== Products hub ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin-bottom: 16px;
}

.product-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.product-card-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.product-icon {
    width: 52px;
    height: 52px;
    background: var(--primary-light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-icon svg {
    width: 26px;
    height: 26px;
    color: var(--primary);
}

.product-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.product-desc {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.5;
}

.product-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.product-link {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--primary);
    color: var(--white);
}

.product-link svg {
    width: 16px;
    height: 16px;
}

.product-link:hover {
    background: var(--primary-dark);
}

.product-link-alt {
    background: var(--gray-100);
    color: var(--gray-700);
}

.product-link-alt:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

/* برچسب محصول روی کارت سوال/آموزش */
.card-product-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-bottom: 12px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.tutorial-type-tag svg {
    width: 12px;
    height: 12px;
}

/* اکشن‌های سرصفحه (دکمه + شمارنده) */
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== Tutorial media ===== */
.tutorial-media {
    margin-bottom: 8px;
}

.tutorial-media video {
    width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    background: #000;
    display: block;
}

.tutorial-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* نسبت 16:9 */
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.tutorial-embed iframe,
.tutorial-embed video,
.tutorial-embed embed,
.tutorial-embed object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
}

/* برچسب محصول داخل نتایج جستجو */
.search-result-product {
    display: inline-block;
    margin-right: 6px;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Ivahid Platform 2026 refinement */
.header { background: rgba(255,255,255,.95); border-bottom: 1px solid #dfe6ef; box-shadow: 0 8px 30px rgba(16,34,61,.045); backdrop-filter: blur(14px); }
.logo-icon { color: #fff; background: #0a0a0a; border-radius: 14px 14px 14px 5px; box-shadow: 0 9px 22px rgba(0,0,0,.18); }
.logo-title { color: #10223d; letter-spacing: -.025em; }
.logo-subtitle { color: #6d7b91; }
.question-card, .product-card, .question-detail, .content-section { border: 1px solid #dfe6ef; border-radius: 16px; box-shadow: 0 1px 2px rgba(16,34,61,.04), 0 8px 24px rgba(16,34,61,.045); }
.question-card:hover, .product-card:hover { border-color: #b9b9b9; box-shadow: 0 18px 44px rgba(0,0,0,.1); transform: translateY(-3px); }
.platform-shortcuts { display: flex; gap: 7px; align-items: center; }
.platform-shortcuts a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 8px 11px; border-radius: 9px; color: #111; background: #f0f0f0; font-size: 12px; font-weight: 700; white-space: nowrap; }
.platform-shortcuts a:hover { color: #fff; background: #0a0a0a; }
.platform-shortcuts svg { width: 17px; height: 17px; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) { .platform-shortcuts { display: none; } }
