/* AOEX frontend — scoped to .aoex-front (safe with any theme incl. WoodMart/Elementor) */
.aoex-front {
    direction: rtl; text-align: right;
    font-family: Vazirmatn, "Vazir", Tahoma, "Segoe UI", sans-serif;
    color: #23324e; line-height: 1.8;
}
.aoex-front * { box-sizing: border-box; }

.aoex-btn {
    display: inline-block; border: 0; border-radius: 8px; padding: 10px 22px;
    font-family: inherit; font-size: 15px; cursor: pointer; color: #fff;
    background: #1b2a4a; transition: all .18s; text-decoration: none;
}
.aoex-btn:hover { opacity: .9; transform: translateY(-1px); }
.aoex-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.aoex-btn-gold { background: linear-gradient(135deg, #c9a227, #a8841a); }
.aoex-btn-navy { background: #1b2a4a; }
.aoex-btn-ghost { background: transparent; color: #1b2a4a; border: 2px solid #1b2a4a; }

.aoex-badge {
    display: inline-block; color: #fff; background: #666; border-radius: 12px;
    padding: 2px 10px; font-size: 12px;
}

/* ---- login page ---- */
.aoex-login-wrap {
    max-width: 980px; margin: 24px auto; padding: 0 16px;
}
.aoex-login-header { text-align: center; margin-bottom: 24px; }
.aoex-login-header .aoex-logo { max-height: 90px; margin-bottom: 12px; }
.aoex-login-header h1 { color: #1b2a4a; font-size: 26px; margin: 0; }
.aoex-login-cols {
    display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px;
    background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 8px 30px rgba(27, 42, 74, .1); border: 1px solid #e7eaf2;
}
.aoex-login-form-col { padding: 32px 28px; background: #fafbfe; }
.aoex-login-guide-col { padding: 32px 28px; background: #1b2a4a; color: #e8ecf5; }
.aoex-login-guide-col h3 { color: #e3c04a; margin-top: 0; }
.aoex-login-guide-col .aoex-guide-box { white-space: pre-line; font-size: 13.5px; opacity: .92; }
.aoex-login-guide-col .aoex-notice-box {
    background: rgba(227, 192, 74, .15); border: 1px solid rgba(227, 192, 74, .4);
    border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
}
.aoex-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.aoex-field label { font-weight: 700; font-size: 14px; }
/* v1.4.1: radios/checkboxes excluded — width:100% squashed them to slivers
   inside flex option rows (question builder). Text-like inputs keep 100%. */
.aoex-field input:not([type="radio"]):not([type="checkbox"]),
.aoex-field select, .aoex-field textarea {
    border: 1px solid #d5dbe8; border-radius: 8px; padding: 10px 12px;
    font-family: inherit; font-size: 15px; width: 100%; background: #fff;
}
.aoex-field input[type="radio"], .aoex-field input[type="checkbox"] {
    width: 16px; height: 16px; margin: 0; flex: 0 0 auto;
}
/* v1.5.0: question-option text inputs must NEVER inherit width:100% —
   inside the flex .aoex-option-row that crushed them to a sliver on the
   left edge (question builder + bank pages). Force flex sizing instead.
   v1.5.1: also neutralizes the legacy ".aoex-front * { width:100% }" star
   rule from the old plugin version still present on some sites. */
.aoex-field .aoex-option-row input[type="text"],
.aoex-option-row input[type="text"] {
    width: auto !important; flex: 1 1 auto !important; min-width: 120px !important;
}
.aoex-front .aoex-option-row input[type="text"] { width: auto !important; }
.aoex-front .button, .aoex-front .aoex-btn { width: auto !important; }
.aoex-front input[type="radio"], .aoex-front input[type="checkbox"] { width: 16px !important; height: 16px; }
.aoex-field input:focus, .aoex-field textarea:focus { outline: 2px solid #c9a227; border-color: #c9a227; }
.aoex-login-msg { min-height: 22px; font-size: 13px; margin-bottom: 8px; }
.aoex-msg-error { color: #c0392b; }
.aoex-msg-ok { color: #1e7e34; }
@media (max-width: 720px) { .aoex-login-cols { grid-template-columns: 1fr; } }

/* ---- dashboard ---- */
.aoex-dash { max-width: 1080px; margin: 20px auto; padding: 0 16px; }
.aoex-dash-header {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: #fff; border: 1px solid #e7eaf2; border-radius: 12px; padding: 14px 20px; flex-wrap: wrap;
}
.aoex-dash-header h2 { margin: 0; color: #1b2a4a; font-size: 20px; }
.aoex-dash-user { display: flex; align-items: center; gap: 12px; }
.aoex-logo-sm { max-height: 44px; display: block; margin-bottom: 6px; }
.aoex-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.aoex-card {
    background: #fff; border: 1px solid #e7eaf2; border-radius: 12px; padding: 18px;
    display: flex; flex-direction: column; gap: 8px;
}
.aoex-card-title { font-weight: 700; font-size: 16px; color: #1b2a4a; }
.aoex-card-meta { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.aoex-card-meta li { padding: 2px 0; }
.aoex-card-actions { margin-top: auto; padding-top: 8px; }
.aoex-empty { background: #fff8e6; border: 1px solid #eedc9a; border-radius: 8px; padding: 12px; }
.aoex-table { width: 100%; border-collapse: collapse; background: #fff; margin-top: 12px; }
.aoex-table th, .aoex-table td { border: 1px solid #e2e6ef; padding: 9px 10px; text-align: right; font-size: 13.5px; }
.aoex-table th { background: #f4f6fa; }

/* ---- intro ---- */
.aoex-box {
    max-width: 760px; margin: 20px auto; background: #fff; border: 1px solid #e7eaf2;
    border-radius: 14px; padding: 28px; text-align: center;
}
.aoex-intro .aoex-logo { max-height: 80px; margin-bottom: 8px; }
.aoex-bismillah { color: #c9a227; font-size: 18px; margin: 6px 0; }
.aoex-intro h2 { color: #1b2a4a; margin: 4px 0 12px; }
.aoex-meta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.aoex-meta span { background: #f4f6fa; border-radius: 8px; padding: 6px 12px; font-size: 13.5px; }
.aoex-desc { text-align: right; color: #4a5670; margin: 10px 0; }
.aoex-rules {
    text-align: right; background: #fbfbe8; border: 1px solid #ece9c2; border-radius: 8px; padding: 12px 16px; margin: 14px 0;
}
.aoex-rules h3 { margin: 0 0 6px; font-size: 15px; }
.aoex-rules pre { white-space: pre-wrap; font-family: inherit; margin: 0; font-size: 13px; }
.aoex-accept { display: flex; gap: 8px; align-items: flex-start; text-align: right; font-size: 14px; margin: 14px 0; }
.aoex-start-row { margin-top: 16px; }
.aoex-start-row .aoex-btn { font-size: 17px; padding: 13px 34px; }

/* ---- runner ---- */
.aoex-runner-top {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: #1b2a4a; color: #fff; border-radius: 12px 12px 0 0; padding: 10px 18px;
    position: sticky; top: 0; z-index: 50;
}
.aoex-rt-name { font-weight: 700; }
.aoex-rt-exam { font-size: 13.5px; opacity: .85; }
.aoex-rt-timer {
    font-size: 20px; font-weight: 700; color: #ffd966;
    font-variant-numeric: tabular-nums; margin-inline-start: auto;
    background: rgba(255,255,255,.08); padding: 4px 14px; border-radius: 8px;
}
.aoex-rt-timer.danger { color: #ff8f8f; animation: aoex-blink 1s infinite; }
@keyframes aoex-blink { 50% { opacity: .55; } }
.aoex-rt-stats { font-size: 13px; opacity: .9; }
.aoex-rt-stats .answered-c { color: #7be38a; font-weight: 700; }
.aoex-rt-stats .unanswered-c { color: #ffb0b0; font-weight: 700; }
.aoex-rt-stats .doubt-c { color: #ffd966; font-weight: 700; }
.aoex-runner-body {
    display: grid; grid-template-columns: 240px 1fr; gap: 0;
    background: #fff; border: 1px solid #e7eaf2; border-top: 0; border-radius: 0 0 12px 12px; overflow: hidden;
}
.aoex-palette {
    background: #f4f6fa; padding: 12px; display: flex; flex-wrap: wrap; gap: 6px;
    align-content: flex-start; max-height: 70vh; overflow: auto; border-left: 1px solid #e2e6ef;
}
.aoex-pq {
    width: 40px; height: 40px; border-radius: 8px; border: 1px solid #cfd6e4; cursor: pointer;
    background: #e6e9f2; color: #4a5670; font-size: 14px; font-family: inherit;
}
.aoex-pq.answered { background: #1e7e34; border-color: #1e7e34; color: #fff; }
.aoex-pq.flagged { background: #f7c600; border-color: #d9ac00; color: #5c4700; }
.aoex-pq.current { background: #1b2a4a; border-color: #1b2a4a; color: #fff; box-shadow: 0 0 0 3px rgba(27,42,74,.25); }
.aoex-question-area { padding: 20px 24px; }
.aoex-question-box.flagged .aoex-q-bar { background: #b98e00; }
.aoex-q-bar {
    display: flex; align-items: center; gap: 12px; background: #1b2a4a; color: #fff;
    border-radius: 8px; padding: 7px 14px; margin-bottom: 14px; animation: none;
}
.aoex-question-box.flagged .aoex-q-bar { animation: none; }
/* v1.3.0: «شک دارم» button — marks a question as doubtful (yellow in the palette) */
.aoex-doubt-btn {
    cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit;
    color: #ffd966; background: rgba(255,255,255,.08); border: 1px solid #ffd966;
    border-radius: 8px; padding: 4px 14px; margin-inline-start: 0; transition: all .15s;
}
.aoex-doubt-btn:hover { background: rgba(255,217,102,.18); }
.aoex-doubt-btn.active { background: #f7c600; border-color: #f7c600; color: #4a3b00; }
.aoex-q-no { font-size: 13.5px; }
/* v1.5.0: scoped to the exam runner — this used to leak onto the builder's
   question textarea in the designer panel (user-select:none made typed text
   hard/impossible to select, and the margins looked broken). */
#aoex-runner .aoex-q-text { font-size: 16.5px; white-space: pre-wrap; user-select: none; -webkit-user-select: none; margin-bottom: 12px; }
.aoex-q-img { max-width: 100%; max-height: 320px; border-radius: 8px; margin-bottom: 12px; }
.aoex-options { display: flex; flex-direction: column; gap: 8px; }
.aoex-opt {
    display: flex; gap: 10px; align-items: center; border: 2px solid #e2e6ef; border-radius: 10px;
    padding: 10px 14px; cursor: pointer; transition: all .15s; user-select: none; -webkit-user-select: none;
}
.aoex-opt:hover { border-color: #c9a227; }
.aoex-opt.selected { border-color: #1b2a4a; background: #f4f6fa; }
.aoex-opt input { accent-color: #1b2a4a; width: 18px; height: 18px; }
.aoex-essay-wrap { margin-top: 6px; }
.aoex-essay {
    width: 100%; min-height: 160px; border: 2px solid #e2e6ef; border-radius: 10px; padding: 12px;
    font-family: inherit; font-size: 15px; resize: vertical;
}
.aoex-essay:focus { outline: none; border-color: #c9a227; }
.aoex-save-ind { font-size: 12px; color: #1e7e34; margin-top: 4px; min-height: 18px; }
.aoex-save-ind.saving { color: #b06a00; }
.aoex-nav { display: flex; justify-content: space-between; margin-top: 18px; gap: 10px; }
@media (max-width: 720px) {
    .aoex-runner-body { grid-template-columns: 1fr; }
    .aoex-palette { border-left: 0; border-bottom: 1px solid #e2e6ef; flex-direction: row; max-height: none; overflow-x: auto; }
    .aoex-question-area { padding: 14px; }
}

/* submit modal */
.aoex-modal-overlay {
    position: fixed; inset: 0; background: rgba(10, 16, 30, .65); z-index: 100000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.aoex-modal-box {
    background: #fff; border-radius: 14px; padding: 26px; max-width: 440px; width: 100%; text-align: center;
}
.aoex-modal-box h3 { color: #1b2a4a; margin-top: 0; }
.aoex-warn { color: #c0392b; font-weight: 700; }
.aoex-modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.aoex-vio-toast {
    position: absolute; top: 100%; right: 0; background: #c0392b; color: #fff;
    border-radius: 8px; padding: 8px 14px; font-size: 13px; margin-top: 6px; z-index: 60;
}

/* finish */
.aoex-finish h2 { color: #1e7e34; }
.aoex-hint-sm { color: #777; font-size: 13px; }

/* report card */
.aoex-report { max-width: 860px; margin: 20px auto; padding: 0 16px; }
.aoex-report-head { text-align: center; margin-bottom: 14px; }
.aoex-report-head .aoex-logo { max-height: 80px; margin-bottom: 6px; }
.aoex-report-total {
    display: flex; gap: 24px; justify-content: center; background: #1b2a4a; color: #fff;
    border-radius: 10px; padding: 14px; margin: 14px 0; font-size: 16px;
}
.aoex-report-total b { color: #ffd966; }
@media print {
    .aoex-report .aoex-print { display: none; }
    .aoex-report { max-width: none; }
}
