/* آزمون‌ساز حرفه‌ای NewDiv — front-end
 * Colours are custom properties: override them in your theme, e.g.
 * .ndaz { --ndaz-accent: #7a3e9d; }
 */
.ndaz {
    --ndaz-accent: #1f6f78;
    --ndaz-accent-soft: #e6f1f2;
    --ndaz-warm: #c8873a;
    --ndaz-ink: #1e2a2c;
    --ndaz-muted: #6b7a7c;
    --ndaz-line: #dfe6e6;
    --ndaz-card: #ffffff;
    --ndaz-bg: #f7f9f9;
    --ndaz-radius: 14px;
    --ndaz-ok: #2e7d4f;
    --ndaz-err: #b3413a;
    direction: rtl;
    text-align: right;
    color: var(--ndaz-ink);
    font-family: inherit;
    line-height: 1.9;
}
.ndaz *, .ndaz *::before, .ndaz *::after { box-sizing: border-box; }

/* Cards & notices ---------------------------------------------------- */
.ndaz-card {
    background: var(--ndaz-card);
    border: 1px solid var(--ndaz-line);
    border-radius: var(--ndaz-radius);
    padding: 22px 24px;
    margin: 0 0 18px;
}
.ndaz-card h3 { margin: 0 0 12px; font-size: 1.15em; }
.ndaz-intro { margin-bottom: 24px; }

.ndaz-notice {
    border-radius: 10px;
    padding: 12px 16px;
    margin: 0 0 18px;
    border-inline-start: 4px solid var(--ndaz-accent);
    background: var(--ndaz-accent-soft);
}
.ndaz-notice--success { border-color: var(--ndaz-ok); background: #eaf5ee; }
.ndaz-notice--error { border-color: var(--ndaz-err); background: #fbeeed; }

/* Buttons -------------------------------------------------------------- */
.ndaz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    padding: 0 26px;
    border: 1px solid var(--ndaz-accent);
    border-radius: 999px;
    background: var(--ndaz-accent);
    color: #fff !important;
    font: inherit;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.ndaz-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(31, 111, 120, .22); }
.ndaz-btn:focus-visible { outline: 3px solid var(--ndaz-warm); outline-offset: 2px; }
.ndaz-btn--ghost { background: transparent; color: var(--ndaz-accent) !important; }
.ndaz-btn--block { width: 100%; }
.ndaz-btn--sm { min-height: 34px; padding: 0 14px; font-size: .9em; }
.ndaz-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.ndaz-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }
.ndaz-actions .ndaz-submit { margin-inline-start: auto; }

/* Progress -------------------------------------------------------------- */
.ndaz-progress {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--ndaz-bg);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 18px;
}
.ndaz-progress__bar { height: 8px; background: var(--ndaz-line); border-radius: 99px; overflow: hidden; }
.ndaz-progress__bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--ndaz-warm), var(--ndaz-accent));
    border-radius: inherit;
    transition: width .3s ease;
}
.ndaz-progress__text { font-size: .85em; color: var(--ndaz-muted); margin-top: 4px; }

/* Questions ------------------------------------------------------------- */
.ndaz-section {
    font-size: 1.05em;
    color: var(--ndaz-warm);
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px dashed var(--ndaz-line);
}
.ndaz-q {
    border: 1px solid var(--ndaz-line);
    border-radius: var(--ndaz-radius);
    background: var(--ndaz-card);
    padding: 18px 20px;
    margin: 0 0 14px;
    min-width: 0;
}
.ndaz-q.is-invalid { border-color: var(--ndaz-err); }
.ndaz-q__title { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; padding: 0; margin-bottom: 12px; float: none; width: 100%; }
.ndaz-q__num {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ndaz-accent-soft);
    color: var(--ndaz-accent);
    font-size: .9em;
}
.ndaz-q__answers { display: grid; gap: 8px; }
.ndaz-q__error { color: var(--ndaz-err); font-size: .9em; margin: 8px 0 0; }

.ndaz-a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--ndaz-line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    margin: 0;
}
.ndaz-a:hover { border-color: var(--ndaz-accent); }
.ndaz-a input { position: absolute; opacity: 0; pointer-events: none; }
.ndaz-a__mark {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ndaz-muted);
    border-radius: 50%;
    transition: all .15s ease;
}
.ndaz-a input[type="checkbox"] + .ndaz-a__mark { border-radius: 6px; }
.ndaz-a input:checked + .ndaz-a__mark { border-color: var(--ndaz-accent); box-shadow: inset 0 0 0 4px #fff; background: var(--ndaz-accent); }
.ndaz-a:has(input:checked) { border-color: var(--ndaz-accent); background: var(--ndaz-accent-soft); }
.ndaz-a input:focus-visible + .ndaz-a__mark { outline: 3px solid var(--ndaz-warm); outline-offset: 2px; }

/* Step mode (JS adds .is-js) */
.ndaz-form.is-steps.is-js .ndaz-q,
.ndaz-form.is-steps.is-js .ndaz-section { display: none; }
.ndaz-form.is-steps.is-js .ndaz-q.is-current,
.ndaz-form.is-steps.is-js .ndaz-section.is-current { display: block; animation: ndaz-in .25s ease; }
@keyframes ndaz-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Paywall & login ------------------------------------------------------- */
.ndaz-paywall, .ndaz-login { text-align: center; max-width: 460px; margin-inline: auto; }
.ndaz-paywall__head { display: grid; gap: 4px; margin-bottom: 18px; }
.ndaz-paywall__label, .ndaz-paywall__meta { color: var(--ndaz-muted); font-size: .9em; }
.ndaz-paywall__price { font-size: 1.8em; color: var(--ndaz-accent); font-weight: 800; }
.ndaz-gateways { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.ndaz-gateway { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--ndaz-line); border-radius: 99px; cursor: pointer; }
.ndaz-gateway:has(input:checked) { border-color: var(--ndaz-accent); background: var(--ndaz-accent-soft); }

/* Result ---------------------------------------------------------------- */
.ndaz-result__head {
    text-align: center;
    padding: 26px 16px;
    margin-bottom: 18px;
    border-radius: var(--ndaz-radius);
    background: linear-gradient(135deg, var(--ndaz-accent), #16494f);
    color: #fff;
}
.ndaz-result__head h2 { color: #fff; margin: 4px 0; font-size: 1.5em; }
.ndaz-result__label, .ndaz-result__date { opacity: .8; font-size: .9em; }
.ndaz-result__item { border-inline-start: 5px solid var(--ndaz-warm); }

.ndaz-chart__cols { display: flex; gap: 14px; justify-content: space-around; align-items: flex-end; min-height: 220px; }
.ndaz-chart__col { flex: 1; max-width: 90px; display: grid; justify-items: center; gap: 4px; text-align: center; }
.ndaz-chart__track { width: 38px; height: 170px; background: var(--ndaz-bg); border-radius: 10px; display: flex; align-items: flex-end; overflow: hidden; }
.ndaz-chart__track span { width: 100%; background: linear-gradient(0deg, var(--ndaz-accent), var(--ndaz-warm)); border-radius: 10px; }
.ndaz-chart__col small { color: var(--ndaz-muted); line-height: 1.4; }

.ndaz-scale { margin-bottom: 14px; }
.ndaz-scale__head { display: flex; justify-content: space-between; font-size: .95em; }
.ndaz-scale__bar { height: 10px; background: var(--ndaz-bg); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.ndaz-scale__bar span { display: block; height: 100%; background: var(--ndaz-accent); border-radius: inherit; }
.ndaz-scale__desc { color: var(--ndaz-muted); font-size: .9em; margin-top: 4px; }

/* List & table ---------------------------------------------------------- */
.ndaz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ndaz-tile { display: grid; gap: 6px; color: inherit !important; text-decoration: none !important; transition: transform .15s ease, box-shadow .15s ease; }
.ndaz-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .07); }
.ndaz-tile__img { width: 100%; height: auto; border-radius: 10px; }
.ndaz-tile__meta { color: var(--ndaz-muted); font-size: .9em; }

.ndaz-table-wrap { overflow-x: auto; }
.ndaz-table { width: 100%; border-collapse: collapse; }
.ndaz-table th, .ndaz-table td { padding: 10px 12px; border-bottom: 1px solid var(--ndaz-line); text-align: right; }
.ndaz-table th { background: var(--ndaz-bg); font-weight: 700; }

@media (max-width: 600px) {
    .ndaz-card, .ndaz-q { padding: 16px; }
    .ndaz-actions .ndaz-btn { flex: 1 1 100%; }
    .ndaz-actions .ndaz-submit { margin-inline-start: 0; }
    .ndaz-table thead { display: none; }
    .ndaz-table tr { display: block; border: 1px solid var(--ndaz-line); border-radius: 10px; margin-bottom: 10px; }
    .ndaz-table td { display: flex; justify-content: space-between; }
    .ndaz-table td::before { content: attr(data-title); font-weight: 700; }
}

@media print {
    .ndaz-actions, .ndaz-progress { display: none !important; }
    .ndaz-result__head { background: none; color: #000; border: 1px solid #000; }
    .ndaz-result__head h2 { color: #000; }
}
