/* ===================== پایه ===================== */
.irmath-content {
    font-family: Vazirmatn, IRANSans, Tahoma, sans-serif;
    line-height: 2.2;
    font-size: 16px;
    color: #243447;
}

/* ===================== تیتر ===================== */
.irmath-content h2 {
    background: linear-gradient(to left, #60a5fa, #3b82f6);
    color: #fff;
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 1.3rem;
    margin: 32px 0 20px;
}

/* ===================== باکس پایه ===================== */
.irmath {
    border-radius: 18px;
    padding: 18px 20px;
    margin: 20px 0;
    background: #ffffff;
    border: 2px dashed #e5e7eb;
    line-height: 2.2;
}
.irmath::before {
    font-weight: 800;
    display: block;
    margin-bottom: 8px;
}

/* ===================== انواع ===================== */
.definition { background:#eff6ff; border-color:#93c5fd; }
.irmath.definition::before { content:"📘 تعریف"; color:#1d4ed8; }

.example { background:#ecfeff; border-color:#67e8f9; }
.irmath.example::before { content:"✏️ مثال حل‌شده"; color:#0e7490; }

.exercise { background:#fffbe6; border-color:#fde68a; }
.irmath.exercise::before { content:"📝 تمرین"; color:#92400e; }

.answer { background:#f0fdf4; border-color:#86efac; display:none; }
.irmath.answer::before { content:"✅ پاسخ"; color:#166534; }

.tip { background:#f0fdf4; border-color:#4ade80; }
.irmath.tip::before{  content:"💡 نکته مهم";  color:#15803d;}


.theorem { background:#fff7ed; border-color:#fdba74; }
.irmath.theorem::before { content:"📐 قضیه"; color:#c2410c; }

.lemma { background:#faf5ff; border-color:#c4b5fd; }
.irmath.lemma::before { content:"🔍 لم"; color:#6d28d9; }

.explanation { background:#f8fafc; border-color:#94a3b8; }
.irmath.explanation::before { content:"🧠 توضیح"; color:#334155; }

/* ===================== فرمول / MathJax ===================== */
.formula {
    background:#f1f5f9;
    border:2px solid #c7d2fe;
    text-align:center;
    direction:ltr;
    font-size:1.15rem;
}

mjx-container {
    background:#f8fafc;
    padding:10px 14px;
    border-radius:12px;
    border:2px solid #c7d2fe;
    margin:14px 0;
}

/* ===================== دکمه‌ها ===================== */
.irmath-btn {
    border:none;
    padding:7px 16px;
    border-radius:14px;
    font-family:inherit;
    font-size:14px;
    cursor:pointer;
    margin:10px 0;
    color:#fff;
}

.btn-answer { background:#22c55e; }
.btn-print  { background:#2563eb; float:left; }

/* ===================== موبایل ===================== */
@media (max-width:600px){
    .irmath-content{font-size:15px}
    .irmath-content h2{font-size:1.15rem}
}

/* ===================== پرینت ===================== */
@media print {

    button { display:none !important; }

    .irmath {
        page-break-inside: avoid;
        border:1px solid #999;
    }

    body::before {
        content:"سایت ریاضیات ایران | irmath.ir";
        display:block;
        text-align:center;
        font-weight:700;
        margin-bottom:20px;
        color:#1e40af;
    }

    body::after {
        content:"© ریاضیات ایران — irmath.ir";
        position:fixed;
        bottom:10px;
        width:100%;
        text-align:center;
        font-size:12px;
        color:#475569;
    }
}
  /* ===================== فقط ناحیه PDF ===================== */
@media print {

    @page {
        size: A4;
        margin: 20mm;
      counter-reset: page 1;
    }

    body * {
        visibility: hidden !important;
    }

    #pdrarea, #pdrarea * {
        visibility:visible !important;
    }

    #pdrarea {
        position: static;   /* 👈 */
    width: 100%;
        left: 0;
        top: 0;
        width: 100%;
        font-family: Vazirmatn, IRANSans, Tahoma, sans-serif;
    }

    /* ---------- هدر ---------- */
    .pdf-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 80px;
    }

    .pdf-logo {
        position: absolute;
        right: 0;
        top: 10px;
    }
    .pdf-logo img {
        height: 50px;
    }

    .pdf-title {
        text-align: center;
        font-size: 18px;
        font-weight: 700;
        color: #1e40af;
        margin-top: 20px;
    }

    .pdf-phone {
        position: absolute;
        left: 0;
        top: 28px;
        font-size: 13px;
        color: #334155;
    }

    /* ---------- محتوا ---------- */
    .pdf-content {
        margin-top: 100px;
        margin-bottom: 80px;
    }
.pdf-header,
    .pdf-footer {
        position: fixed;
    }
    /* ---------- فوتر ---------- */
    .pdf-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        font-size: 12px;
        color: #475569;
    }

    .pdf-instagram {
        position: absolute;
        left: 0;
        bottom: 10px;
    }

    .pdf-telegram {
        position: absolute;
        right: 0;
        bottom: 10px;
    }

    .pdf-page {
        text-align: center;
        margin-top: 20px;
    }
    .pdf-page::after {
        content: "صفحه " counter(page);
    }

    /* ---------- واترمارک ---------- */
    .pdf-watermark {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-35deg);
        font-size: 80px;
        font-weight: 800;
        color: rgba(0,0,0,0.02);
        z-index: 0;
        white-space: nowrap;
    }
}