/* استایل مشترک صفحات اپ certification (داشبورد، جزئیات گواهی‌نامه) */

.cert-dashboard {
    max-width: 900px;
    margin: 40px auto 80px;
    padding: 0 16px;
}
.cert-page-header {
    text-align: center;
    margin-bottom: 32px;
}
.cert-page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.cert-page-header p {
    color: var(--text);
    font-weight: 600;
}
.cert-text-strong {
    color: var(--text);
    font-weight: 600;
}
.cert-empty-state {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}
.cert-empty-state a {
    color: var(--primary);
    font-weight: 600;
}
.cert-course-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.cert-course-card-narrow {
    max-width: 560px;
    margin: 40px auto;
}
.cert-course-title {
    font-size: 1.15rem;
    margin-bottom: 20px;
    color: var(--primary-dark);
}
.cert-section {
    margin-bottom: 24px;
}
.cert-section:last-child {
    margin-bottom: 0;
}
.cert-section h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}
.cert-muted {
    color: var(--text-light);
    font-size: 0.9rem;
}
.cert-exam-rules {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cert-exam-rules li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.8;
}
.cert-exam-rules i {
    color: var(--primary);
    margin-top: 3px;
}
.cert-booklet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cert-booklet-list li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.9rem;
}
.cert-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.cert-btn-sm {
    min-height: 38px;
    padding: 5px 12px;
    font-size: 0.78rem;
}
.cert-btn-primary {
    background: var(--primary);
    color: #fff;
}
.cert-btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}
.cert-btn-primary:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.7;
}
.cert-btn-outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.cert-btn-outline:hover {
    background: var(--primary);
    color: #fff;
}
.cert-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.cert-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.cert-results-table th, .cert-results-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.cert-results-table th {
    background: var(--bg);
    font-weight: 700;
}
.cert-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}
.cert-badge-pass {
    background: #dcfce7;
    color: #16a34a;
}
.cert-badge-fail {
    background: #fee2e2;
    color: #dc2626;
}
.cert-badge-pending {
    background: #fef3c7;
    color: #b45309;
}

/* دایره‌ی راهنما (؟) -- hover در دسکتاپ، تپ در موبایل */
.cert-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.85rem;
}
.cert-help::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 135%;
    right: 0;
    background: #1e293b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.8;
    width: max-content;
    max-width: min(260px, 80vw);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: var(--transition);
    z-index: 30;
    text-align: right;
}
.cert-help:hover::after,
.cert-help:focus::after,
.cert-help.is-open::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* دکمه‌ی تمام‌عرض فقط در موبایل، برای اکشن‌های اصلی مستقل (نه دکمه‌های
   داخل ردیف جدول یا لیست) */
.cert-btn-block-mobile {
    width: auto;
}

/* دکمه‌های داخل مودال‌های همین اپ (راهنمای آزمون، تأیید حذف عکس) هم به
   حداقل ارتفاع لمسی برسن؛ محدود به مودال‌های داخل صفحات certification،
   نه کل سایت */
.cert-dashboard .modal-footer .btn {
    min-height: 44px;
}

/* ==================== واکنش‌گرا / موبایل ==================== */
@media (max-width: 768px) {
    .cert-dashboard {
        margin: 24px auto 48px;
        padding: 0 12px;
    }
    .cert-course-card-narrow {
        margin: 0 auto;
    }
    .cert-page-header {
        margin-bottom: 24px;
    }
    .cert-page-header h1 {
        font-size: 1.25rem;
    }
    .cert-course-card {
        padding: 16px;
        border-radius: var(--radius);
    }
    .cert-course-title {
        font-size: 1.05rem;
    }
    .cert-section h3 {
        flex-wrap: wrap;
    }
    .cert-btn-block-mobile {
        width: 100%;
    }
    .cert-results-table th,
    .cert-results-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    /* روی صفحه‌ی باریک، تولتیپ راهنما رو وسط‌چین کن تا از لبه‌ی صفحه بیرون نزنه */
    .cert-help::after {
        right: auto;
        left: 50%;
        transform: translate(-50%, 4px);
        text-align: center;
    }
    .cert-help:hover::after,
    .cert-help:focus::after,
    .cert-help.is-open::after {
        transform: translate(-50%, 0);
    }
}

@media (max-width: 380px) {
    .cert-booklet-list li {
        flex-direction: column;
        align-items: stretch;
    }
    .cert-booklet-list li .cert-btn {
        width: 100%;
    }
}

.cert-cd-price-accordion .accordion-button,
.cert-cd-toc-mobile .accordion-button {
    font-weight: 600;
    font-size: 0.92rem;
}

.cert-cd-price-accordion .accordion-button:not(.collapsed),
.cert-cd-toc-mobile .accordion-button:not(.collapsed) {
    color: var(--primary-dark);
    background-color: rgba(124, 58, 237, 0.06);
}

.cert-cd-price-accordion .accordion-button:focus,
.cert-cd-toc-mobile .accordion-button:focus {
    box-shadow: none;
    border-color: rgba(124, 58, 237, 0.25);
}

.cert-cd-price-accordion .accordion-body,
.cert-cd-toc-mobile .accordion-body {
    color: var(--text);
    line-height: 1.9;
    font-size: 0.88rem;
}

.cert-cd-price-accordion {
    margin: 32px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* ========== صفحه‌ی معرفی کامل یک دوره (course_detail) ========== */
.cert-cd-layout {
    max-width: 1500px;
    margin: 0 auto 80px;
    padding: 0 16px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.cert-cd-main {
    flex: 1;
    min-width: 0;
}

.cert-cd-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 90px;
}

.cert-cd-toc {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 90px;
}

.cert-cd-toc-inner {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.cert-cd-toc-inner h4 {
    font-size: 0.9rem;
    color: var(--primary-dark);
    margin: 0 0 14px;
}

.cert-cd-toc-inner nav,
.cert-cd-toc-mobile nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cert-cd-toc-inner nav a,
.cert-cd-toc-mobile nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.6;
    padding: 8px 10px;
    border-radius: 8px;
    transition: var(--transition);
}

.cert-cd-toc-inner nav a i,
.cert-cd-toc-mobile nav a i {
    font-size: 0.7rem;
    color: var(--text-light);
    flex-shrink: 0;
}

.cert-cd-toc-inner nav a:hover,
.cert-cd-toc-mobile nav a:hover {
    background: rgba(124, 58, 237, 0.06);
    color: var(--primary-dark);
}

/* رو دسکتاپ فقط نسخه‌ی سایدبار چسبان دیده می‌شه؛ نسخه‌ی کشویی موبایل
   (بالای صفحه، بعد از هیرو) فقط زیر breakpoint موبایل ظاهر می‌شه */
.cert-cd-toc-mobile {
    display: none;
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.cert-cd-sidebar-inner {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cert-cd-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.cert-cd-sidebar-brand img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cert-cd-sidebar-brand span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.5;
}

.cert-cd-sidebar-contact {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.6;
    transition: var(--transition);
}

.cert-cd-sidebar-contact i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.cert-cd-sidebar-contact:hover {
    background: rgba(124, 58, 237, 0.08);
}

.cert-cd-sidebar-other {
    padding-top: 4px;
}

.cert-cd-sidebar-other h4 {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0 0 12px;
}

.cert-cd-sidebar-course {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 10px;
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.cert-cd-sidebar-course:last-child {
    margin-bottom: 0;
}

.cert-cd-sidebar-course-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.cert-cd-sidebar-course span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.cert-cd-sidebar-course:hover span {
    color: var(--primary);
}

@media (max-width: 900px) {
    .cert-cd-layout {
        flex-direction: column;
    }

    .cert-cd-main {
        order: 1;
    }

    .cert-cd-sidebar {
        order: 2;
        width: 100%;
        position: static;
    }

    .cert-cd-toc-desktop {
        display: none;
    }

    .cert-cd-toc-mobile {
        display: block;
    }
}

.cert-cd-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    overflow: hidden;
    margin-bottom: 32px;
}

.cert-cd-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cert-cd-hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px 28px;
    background: linear-gradient(0deg, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.15) 60%, transparent 100%);
    color: #fff;
    text-align: right;
}

.cert-cd-hero-overlay h1 {
    font-size: 1.6rem;
    margin: 0 0 8px;
}

.cert-cd-hero-overlay p {
    font-size: 0.95rem;
    opacity: 0.92;
    margin: 0;
    max-width: 700px;
}

.cert-cd-body {
    padding: 0 16px;
}

.cert-cd-banner {
    width: 100%;
    aspect-ratio: 7 / 3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 32px 0;
    box-shadow: var(--shadow);
}

.cert-cd-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cert-cd-section-title {
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary-dark);
}

.cert-cd-intro {
    color: var(--text);
    line-height: 2;
    font-size: 0.95rem;
    margin: 28px 0;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.cert-cd-topic-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}

.cert-cd-topic-title {
    font-size: 1.05rem;
    color: var(--primary-dark);
    margin: 0 0 14px;
}

.cert-cd-topic-block {
    margin-bottom: 12px;
}

.cert-cd-topic-block:last-child {
    margin-bottom: 0;
}

.cert-cd-topic-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.cert-cd-topic-block p {
    color: var(--text);
    line-height: 1.9;
    font-size: 0.9rem;
    margin: 0;
}

.cert-cd-contact-box {
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    margin-top: 40px;
    color: #fff;
}

.cert-cd-contact-box h3 {
    font-size: 1.1rem;
    margin: 0 0 18px;
    line-height: 1.6;
}

.cert-cd-contact-box .cert-btn-primary {
    background: #fff;
    color: var(--primary-dark);
}

.cert-cd-contact-box .cert-btn-primary:hover {
    background: var(--bg);
}

@media (max-width: 576px) {
    .cert-cd-hero {
        aspect-ratio: 4 / 3;
    }

    .cert-cd-hero-overlay h1 {
        font-size: 1.25rem;
    }

    .cert-cd-banner {
        aspect-ratio: 4 / 3;
    }

    .cert-cd-body {
        padding: 0 8px;
    }
}
