/* ==========================================================================
   Coach Knowledge Assessment – Frontend Styles
   Namespace: cka- (no conflicts with other plugins)
   ========================================================================== */

/* ── Reset / Base ───────────────────────────────────────────────────────── */
.cka-wrap, .cka-result-wrap {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #333;
    box-sizing: border-box;
}
/* Bottom padding ensures html2canvas captures full content without cut-off */
.cka-result-wrap {
    padding-bottom: 40px;
}
.cka-wrap *, .cka-result-wrap * {
    box-sizing: border-box;
}

/* ── Header / Banner ────────────────────────────────────────────────────── */
.cka-header-logo {
    text-align: right;
    padding: 16px 24px 4px;
}
.cka-bca-logo {
    max-height: 60px;
    max-width: 160px;
}
.cka-banner {
    background: linear-gradient(135deg, #1a4f8a 0%, #2871b0 60%, #3a8fd1 100%);
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 0;
}
.cka-title {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    letter-spacing: .5px;
}

/* ── Main layout ────────────────────────────────────────────────────────── */
.cka-main-layout {
    display: flex;
    gap: 0;
    min-height: 480px;
    padding: 24px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Left panel – scenario tabs ─────────────────────────────────────────── */
.cka-left-panel {
    width: 38%;
    min-width: 220px;
    padding-right: 20px;
}
.cka-scenario-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cka-scenario-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 2px solid #dde4ee;
    border-radius: 32px;
    padding: 12px 18px;
    cursor: pointer;
    transition: all .22s ease;
    position: relative;
}
.cka-scenario-tab:hover {
    border-color: #2871b0;
    background: #f0f6ff;
}
.cka-scenario-tab.cka-active {
    border-color: #FF6633;
    background: #fff8f5;
    box-shadow: 0 2px 12px rgba(255,102,51,.15);
}
.cka-scenario-tab.cka-completed {
    border-color: #27ae60;
    background: #f0fff5;
}
.cka-scenario-num {
    background: #2871b0;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.cka-scenario-tab.cka-active .cka-scenario-num {
    background: #FF6633;
}
.cka-scenario-tab.cka-completed .cka-scenario-num {
    background: #27ae60;
}
.cka-scenario-label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
    letter-spacing: .4px;
    flex: 1;
}
.cka-check-icon {
    color: #27ae60;
    font-size: 16px;
    font-weight: 700;
    opacity: 0;
    transition: opacity .2s;
}
.cka-scenario-tab.cka-completed .cka-check-icon {
    opacity: 1;
}

/* ── Right panel – questions ────────────────────────────────────────────── */
.cka-right-panel {
    flex: 1;
    overflow-y: auto;
    max-height: 600px;
    padding-right: 4px;
}
.cka-right-panel::-webkit-scrollbar { width: 5px; }
.cka-right-panel::-webkit-scrollbar-thumb { background: #cdd6e8; border-radius: 4px; }

.cka-question-block {
    background: #fff;
    border: 1px solid #e2e8f4;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
    transition: box-shadow .2s;
}
.cka-question-block:hover {
    box-shadow: 0 2px 14px rgba(40,113,176,.1);
}
.cka-question-text {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 14px;
    line-height: 1.5;
}
.cka-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cka-option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f4;
    border-radius: 8px;
    cursor: pointer;
    transition: all .18s;
    background: #fafbfd;
}
.cka-option-label:hover {
    border-color: #2871b0;
    background: #f0f6ff;
}
.cka-option-label input[type="radio"] {
    display: none;
}
.cka-radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #b0bec5;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: all .18s;
}
.cka-option-label input[type="radio"]:checked ~ .cka-radio-custom {
    border-color: #2871b0;
    background: #2871b0;
}
.cka-option-label input[type="radio"]:checked ~ .cka-radio-custom::after {
    content: '';
    width: 7px;
    height: 7px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.cka-option-label.cka-selected {
    border-color: #2871b0;
    background: #ebf3ff;
}
.cka-option-text {
    font-size: 13.5px;
    color: #444;
    line-height: 1.45;
}

/* ── Navigation bar ─────────────────────────────────────────────────────── */
.cka-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #e2e8f4;
    padding: 16px 32px;
    background: #fff;
    position: sticky;
    bottom: 0;
    z-index: 10;
}
.cka-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.cka-btn-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: 2px solid #2871b0;
    border-radius: 8px;
    background: #fff;
    color: #2871b0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.cka-btn-nav:hover:not(:disabled) {
    background: #2871b0;
    color: #fff;
}
.cka-btn-nav:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.cka-arrow { font-size: 18px; line-height: 1; }
.cka-btn-submit {
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.cka-btn-submit:hover {
    background: #1e8e4f;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.cka-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.cka-modal-box {
    background: #fff !important;
    border-radius: 14px;
    width: 100%;
    max-width: 620px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
    animation: ckaFadeIn .25s ease;
}
@keyframes ckaFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cka-modal-header {
    background: linear-gradient(135deg, #1a4f8a, #2871b0);
    color: #fff !important;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cka-modal-header h3 {
    margin: 0;
    font-size: 18px;
}
.cka-modal-close {
    background: none;
    border: none;
    color: #fff!important;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.cka-modal-body { padding: 24px; }
.cka-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.cka-form-col label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}
.cka-form-col label span { color: #e74c3c; }
.cka-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #dde4ee;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    transition: border-color .18s;
    outline: none;
}
.cka-input:focus {
    border-color: #2871b0;
    box-shadow: 0 0 0 3px rgba(40,113,176,.12);
}
.cka-form-error {
    background: #fff0f0;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13.5px;
    margin-bottom: 16px;
}
.cka-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.cka-btn-cancel {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 14px;
    cursor: pointer;
    color: #555;
}
.cka-btn-cancel:hover { background: #e8e8e8; }
.cka-btn-final-submit {
    background: #2871b0;
    color: #555;
    border: none;
    border-radius: 8px;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.cka-btn-final-submit:hover { background: #1a5a94; }
.cka-btn-final-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.cka-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    padding: 14px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    animation: ckaSlideUp .3s ease;
}
@keyframes ckaSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cka-toast.cka-toast-success { background: #27ae60; }
.cka-toast.cka-toast-error   { background: #e74c3c; }

/* ── Result Page ────────────────────────────────────────────────────────── */
.cka-result-topbar {
    display: flex;
    justify-content: flex-end;
    padding: 14px 24px 4px;
    max-width: 1200px;
    margin: 0 auto;
}
.cka-btn-download {
    background: linear-gradient(135deg, #2871b0, #1a4f8a);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}
.cka-btn-download:hover { opacity: .85; }
.cka-result-name-heading {
    max-width: 1200px;
    margin: 8px auto 4px;
    padding: 0 24px;
}
.cka-result-name-heading h4 {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 700;
    margin: 0;
}

/* Scenario cards grid */
.cka-scenario-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 24px;
}
.cka-result-card {
    background: #fff;
    border: 1px solid #e2e8f4;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(40,113,176,.07);
}
.cka-result-card-header {
    background: linear-gradient(135deg, #1a4f8a, #2871b0);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cka-result-card-title {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .4px;
}
.cka-result-card-num {
    color: rgba(255,255,255,.55);
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}
.cka-result-card-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px 8px;
}
.cka-donut-wrap svg { display: block; }
.cka-result-card-score {
    font-size: 28px;
    font-weight: 800;
    color: #2871b0;
}
.cka-result-card-bars { padding: 0 18px 16px; }
.cka-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.cka-bar-label { font-size: 12px; color: #777; width: 78px; flex-shrink: 0; white-space: nowrap; }
.cka-bar-bg { flex: 1; background: #eef1f7; border-radius: 4px; height: 8px; overflow: hidden; }
.cka-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.cka-bar-correct   { background: #39CEF3; }
.cka-bar-incorrect { background: #FF6228; }
.cka-bar-val { font-size: 12px; font-weight: 700; color: #444; width: 16px; text-align: right; }

/* Score table */
.cka-score-table-wrap {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 24px;
    overflow-x: auto;
}
.cka-score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.cka-score-table th {
    background: #1a4f8a;
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
}
.cka-score-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e8edf5;
    vertical-align: middle;
}
.cka-score-table tbody tr:nth-child(even) { background: #f7faff; }
.cka-score-table tbody tr:hover { background: #eef4ff; }
.cka-col-score { text-align: center; width: 200px; }
.cka-score-cell { text-align: center; padding: 20px; vertical-align: middle; overflow: visible; }
.cka-total-chart-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 12px; }
.cka-legend { text-align: left; }
.cka-legend-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #444;
    margin-bottom: 5px;
}
.cka-legend-dot {
    width: 13px; height: 13px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

/* Error text */
.cka-error {
    color: #e74c3c;
    font-size: 15px;
    padding: 20px;
    text-align: center;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cka-main-layout {
        flex-direction: column;
        padding: 14px 12px;
    }
    .cka-left-panel { width: 100%; padding-right: 0; margin-bottom: 16px; }
    .cka-right-panel { max-height: none; }
    .cka-form-row { grid-template-columns: 1fr; }
    .cka-scenario-cards-grid { grid-template-columns: 1fr; }
    .cka-nav-bar { padding: 12px 16px; }
    .cka-score-table th, .cka-score-table td { font-size: 12px; padding: 8px 10px; }
}

/* ── Download button loading state ─────────────────────────────────────── */
.cka-btn-download:disabled {
    opacity: .7;
    cursor: wait;
}
.cka-btn-download:disabled::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cka-spin .7s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes cka-spin {
    to { transform: rotate(360deg); }
}