/*
 * OrQuiz Pulse - עיצוב
 *
 * ללא פונטים חיצוניים וללא תלות ברשת. מצב הבדיקות מסומן גם בטקסט וגם בצורה,
 * ולא בצבע בלבד, כדי שהדף יהיה קריא גם למי שאינו מבחין בין הצבעים.
 */

:root {
    --violet: #6a4bff;
    --violet-strong: #5334e8;
    --violet-soft: #f1eeff;

    --ink: #171430;
    --ink-soft: #5b5676;
    --ink-faint: #8b86a5;

    --surface: #ffffff;
    --canvas: #f6f5fb;
    --line: #e4e1f0;

    --pass: #0f7a4f;
    --pass-soft: #e7f6ee;
    --warn: #96590a;
    --warn-soft: #fdf3e2;
    --fail: #b3261e;
    --fail-soft: #fdecea;
    --idle: #6f6a88;
    --idle-soft: #f0eff5;

    --radius: 14px;
    --radius-small: 10px;
    --shadow: 0 1px 2px rgba(23, 20, 48, 0.05), 0 8px 24px rgba(23, 20, 48, 0.06);
}

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

/* מאפיין hidden חייב לגבור על display שמוגדר בכלל מפורש, אחרת אלמנטים
   שמוסתרים מהקוד (כמו סרגל ההתקדמות) ימשיכו להופיע. */
[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    padding: 28px 18px 56px;
    background:
        radial-gradient(ellipse 70% 45% at 50% -8%, rgba(106, 75, 255, 0.12), transparent),
        var(--canvas);
    color: var(--ink);
    font-family: "Segoe UI", "Assistant", "Rubik", "Noto Sans Hebrew", system-ui, -apple-system,
        Arial, sans-serif;
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---------- כותרת ---------- */

.masthead {
    text-align: center;
    padding: 4px 0 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    color: var(--violet-strong);
}

.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(140deg, var(--violet), #9d7bff);
    box-shadow: 0 4px 12px rgba(106, 75, 255, 0.35);
}

h1 {
    font-size: clamp(1.6rem, 5vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.lede {
    max-width: 58ch;
    margin: 12px auto 0;
    color: var(--ink-soft);
    font-size: 1rem;
}

/* ---------- מסקנה ---------- */

.verdict {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    border-top: 4px solid var(--idle);
}

.verdict[data-state="pass"] {
    border-top-color: var(--pass);
}
.verdict[data-state="warn"] {
    border-top-color: var(--warn);
}
.verdict[data-state="fail"] {
    border-top-color: var(--fail);
}
.verdict[data-state="running"] {
    border-top-color: var(--violet);
}

.verdict-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.verdict-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    margin-top: 3px;
    border-radius: 50%;
    background: var(--idle-soft);
    position: relative;
}

.verdict-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 34px;
    text-align: center;
}

.verdict[data-state="pass"] .verdict-icon {
    background: var(--pass-soft);
}
.verdict[data-state="pass"] .verdict-icon::after {
    content: "\2713";
    color: var(--pass);
}
.verdict[data-state="warn"] .verdict-icon {
    background: var(--warn-soft);
}
.verdict[data-state="warn"] .verdict-icon::after {
    content: "!";
    color: var(--warn);
}
.verdict[data-state="fail"] .verdict-icon {
    background: var(--fail-soft);
}
.verdict[data-state="fail"] .verdict-icon::after {
    content: "\00D7";
    color: var(--fail);
    font-size: 1.4rem;
}
.verdict[data-state="running"] .verdict-icon {
    background: var(--violet-soft);
    border: 3px solid rgba(106, 75, 255, 0.25);
    border-top-color: var(--violet);
    animation: spin 0.9s linear infinite;
}

.verdict-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
}

.verdict-summary {
    margin-top: 6px;
    color: var(--ink-soft);
}

.verdict-action {
    margin-top: 14px;
    padding: 13px 15px;
    background: var(--violet-soft);
    border-radius: var(--radius-small);
    font-weight: 500;
}

/* ---------- התקדמות ---------- */

.progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.progress-bar {
    flex: 1;
    height: 7px;
    border-radius: 99px;
    background: var(--idle-soft);
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--violet), #9d7bff);
    transition: width 0.35s ease;
}

.progress-label {
    font-size: 0.85rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- לוחות ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}

.panel-accent {
    border-color: rgba(106, 75, 255, 0.35);
    background: linear-gradient(180deg, rgba(106, 75, 255, 0.045), transparent), var(--surface);
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.panel-note {
    color: var(--ink-soft);
    font-size: 0.93rem;
    margin-bottom: 14px;
}

/* ---------- רשימת בדיקות ---------- */

.tests {
    list-style: none;
    margin-top: 12px;
}

.test {
    border-top: 1px solid var(--line);
    padding: 13px 0;
}

.test:first-child {
    border-top: none;
    padding-top: 4px;
}

.test-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.test-name {
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 40%;
}

.test-description {
    display: block;
    font-weight: 400;
    font-size: 0.87rem;
    color: var(--ink-faint);
    margin-top: 1px;
}

.test-duration {
    font-size: 0.82rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

.pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--idle-soft);
    color: var(--idle);
}

.pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.pill[data-state="pass"] {
    background: var(--pass-soft);
    color: var(--pass);
}
.pill[data-state="warn"] {
    background: var(--warn-soft);
    color: var(--warn);
}
.pill[data-state="fail"] {
    background: var(--fail-soft);
    color: var(--fail);
}
.pill[data-state="running"] {
    background: var(--violet-soft);
    color: var(--violet-strong);
}
.pill[data-state="running"]::before {
    animation: pulse 1s ease-in-out infinite;
}

.test-detail {
    margin-top: 7px;
    font-size: 0.9rem;
    color: var(--ink-soft);
    padding-inline-start: 2px;
}

.test-detail code {
    font-size: 0.85em;
    background: var(--idle-soft);
    padding: 1px 5px;
    border-radius: 5px;
    direction: ltr;
    display: inline-block;
}

/* ---------- כתובות לפתיחה ---------- */

.whitelist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.whitelist li {
    padding: 12px 14px;
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
}

.whitelist-host {
    display: block;
    direction: ltr;
    text-align: left;
    font-weight: 700;
    font-size: 1rem;
    word-break: break-all;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.whitelist-protocols {
    display: block;
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--ink-soft);
}

/* ---------- כפתורים ---------- */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 11px 18px;
    border-radius: var(--radius-small);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(23, 20, 48, 0.04);
    transition:
        transform 0.12s ease,
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.button:hover:not(:disabled) {
    background: var(--violet-soft);
    border-color: rgba(106, 75, 255, 0.4);
}

.button:active:not(:disabled) {
    transform: translateY(1px);
}

.button:focus-visible {
    outline: 3px solid rgba(106, 75, 255, 0.45);
    outline-offset: 2px;
}

.button:disabled {
    opacity: 0.55;
    cursor: default;
}

.button-primary {
    background: var(--violet);
    border-color: var(--violet);
    color: #fff;
    box-shadow: 0 6px 16px rgba(106, 75, 255, 0.28);
}

.button-primary:hover:not(:disabled) {
    background: var(--violet-strong);
    border-color: var(--violet-strong);
}

.button-quiet {
    background: transparent;
    border-color: transparent;
    color: var(--violet-strong);
    box-shadow: none;
}

/* ---------- קוד אבחון ומידע טכני ---------- */

.support-code {
    text-align: center;
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.support-code strong {
    direction: ltr;
    display: inline-block;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 2px 9px;
    color: var(--ink);
}

pre {
    direction: ltr;
    text-align: left;
    background: #14122b;
    color: #e6e2ff;
    padding: 16px;
    border-radius: var(--radius-small);
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.55;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.footnote {
    color: var(--ink-faint);
    font-size: 0.86rem;
    text-align: center;
    max-width: 62ch;
    margin: 0 auto;
}

/* ---------- הודעה צפה ---------- */

.toast {
    position: fixed;
    inset-block-end: 22px;
    inset-inline-start: 50%;
    transform: translateX(50%);
    background: var(--ink);
    color: #fff;
    padding: 11px 20px;
    border-radius: 99px;
    font-size: 0.92rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(23, 20, 48, 0.3);
    z-index: 10;
}

/* ---------- אנימציות ---------- */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    50% {
        opacity: 0.25;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }
}

/* ---------- מצב כהה ---------- */

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #f2f0ff;
        --ink-soft: #b5b0cf;
        --ink-faint: #8f8ab0;
        --surface: #1a1834;
        --canvas: #100e24;
        --line: #302c53;
        --violet-soft: #251f4d;
        --pass: #6ee7a8;
        --pass-soft: #14321f;
        --warn: #fcd493;
        --warn-soft: #3a2c10;
        --fail: #ffa79f;
        --fail-soft: #3d1714;
        --idle: #a49fc4;
        --idle-soft: #262246;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    }

    .support-code strong,
    pre {
        background: #0b0a1c;
    }
}

/* ---------- הדפסה ---------- */

@media print {
    body {
        background: #fff;
        padding: 0;
        font-size: 12pt;
    }

    .actions,
    .progress,
    .toast {
        display: none;
    }

    .panel,
    .verdict {
        box-shadow: none;
        break-inside: avoid;
    }

    #tech {
        display: block !important;
    }
}
