/* ============================================
   Kandidattest – Kandidatportal Styles
   ============================================ */

.ktp-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #2c3e50;
    line-height: 1.6;
}

.ktp-container * { box-sizing: border-box; }

/* ── HEADER ── */
.ktp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px;
    background: linear-gradient(135deg, #2c3e50, #3a5068);
    border-radius: 16px;
    color: #fff;
    margin-bottom: 20px;
}

.ktp-header-welcome {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ktp-header-welcome h2 { margin: 0; font-size: 1.3em; }
.ktp-header-party { margin: 4px 0 0; opacity: 0.8; font-size: 0.9em; }

.ktp-header-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.3);
}

.ktp-header-stats {
    display: flex;
    gap: 20px;
}

.ktp-stat { text-align: center; }
.ktp-stat-num { display: block; font-size: 1.5em; font-weight: 700; }
.ktp-stat-label { font-size: 0.75em; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.5px; }
.ktp-stat-deadline { font-size: 0.95em; }

/* ── PROGRESS ── */
.ktp-progress { margin-bottom: 20px; }

.ktp-progress-bar {
    width: 100%;
    height: 10px;
    background: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
}

.ktp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.ktp-progress-text {
    text-align: center;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-top: 6px;
}

/* ── STATUS MESSAGE ── */
.ktp-status {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9em;
    text-align: center;
    transition: opacity 0.3s;
}

.ktp-status-success { background: #d5f5e3; color: #1e8449; }
.ktp-status-error { background: #fadbd8; color: #c0392b; }
.ktp-status-saving { background: #fef9e7; color: #b7950b; }

/* ── INSTRUCTIONS ── */
.ktp-instructions {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 0.9em;
    color: #555;
    border-left: 4px solid #3498db;
}

.ktp-instructions p { margin: 0; }

/* ── CATEGORY ── */
.ktp-category { margin-bottom: 32px; }

.ktp-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #2c3e50;
    color: #fff;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.ktp-category-header h3 { margin: 0; font-size: 1em; }

.ktp-category-count {
    background: rgba(255,255,255,0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

/* ── QUESTION CARD ── */
.ktp-question-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    border: 1px solid #e8ecef;
    border-top: none;
    background: #fff;
    transition: background 0.3s, border-color 0.3s;
}

.ktp-question-card:last-child { border-radius: 0 0 10px 10px; }

.ktp-question-card.ktp-answered {
    background: #fafffe;
    border-left: 3px solid #27ae60;
}

.ktp-question-card.ktp-saving {
    opacity: 0.7;
}

/* ── STATUS CHECK ── */
.ktp-question-status { flex-shrink: 0; padding-top: 2px; }

.ktp-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.85em;
    background: #ecf0f1;
    color: #bdc3c7;
    transition: all 0.3s;
}

.ktp-check-done {
    background: #27ae60;
    color: #fff;
    font-weight: 700;
}

/* ── QUESTION CONTENT ── */
.ktp-question-content { flex: 1; min-width: 0; }

.ktp-question-text {
    font-size: 1.05em;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.4;
    color: #2c3e50;
}

.ktp-question-desc {
    font-size: 0.85em;
    color: #7f8c8d;
    margin: 0 0 14px 0;
}

/* ── ANSWER OPTIONS (radio buttons) ── */
.ktp-answer-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ktp-answer-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88em;
    transition: all 0.2s;
    user-select: none;
    background: #fff;
}

.ktp-answer-option:hover {
    border-color: #95a5a6;
    background: #f8f9fa;
}

.ktp-answer-option.ktp-selected {
    border-color: #2c3e50;
    background: #2c3e50;
    color: #fff;
}

.ktp-answer-option input[type="radio"] {
    display: none;
}

.ktp-answer-radio {
    width: 16px;
    height: 16px;
    border: 2px solid #bdc3c7;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}

.ktp-answer-option.ktp-selected .ktp-answer-radio {
    border-color: #fff;
    background: transparent;
}

.ktp-answer-option.ktp-selected .ktp-answer-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ── COMMENT ── */
.ktp-comment-wrapper { margin-top: 4px; }

.ktp-comment-field { display: none; }
.ktp-comment-field.ktp-comment-visible { display: block; }

.ktp-comment-toggle {
    display: inline-block;
    font-size: 0.82em;
    color: #7f8c8d;
    cursor: pointer;
    margin-bottom: 6px;
}

.ktp-comment-toggle:hover { color: #2c3e50; }

.ktp-comment-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88em;
    resize: vertical;
    transition: border-color 0.2s;
    min-height: 40px;
}

.ktp-comment-field:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

/* ── SUBMIT AREA ── */
.ktp-submit-area {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 2px solid #ecf0f1;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    gap: 16px;
}

.ktp-submit-info p { margin: 0; font-size: 0.82em; color: #7f8c8d; }

.ktp-submit-summary {
    flex-shrink: 0;
    background: #f0f4f8;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
    color: #2c3e50;
}

/* ── ERROR / NO-TOKEN PAGES ── */
.ktp-error-page {
    text-align: center;
    padding: 60px 20px;
}

.ktp-error-page h2 { font-size: 1.6em; margin-bottom: 16px; }
.ktp-error-page p { color: #555; max-width: 500px; margin: 0 auto 12px; }

.ktp-notice {
    padding: 16px 20px;
    border-radius: 10px;
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

.ktp-notice h3 { margin: 0 0 8px; }
.ktp-notice p { margin: 0 0 6px; }
.ktp-notice p:last-child { margin: 0; }

.ktp-notice-error { background: #fadbd8; border: 1px solid #e74c3c; color: #922b21; }
.ktp-notice-warning { background: #fef9e7; border: 1px solid #f1c40f; color: #7d6608; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
    .ktp-header { flex-direction: column; text-align: center; }
    .ktp-header-welcome { flex-direction: column; }
    .ktp-answer-options { flex-direction: column; }
    .ktp-answer-option { justify-content: center; }
    .ktp-submit-area { flex-direction: column; text-align: center; }
    .ktp-question-card { flex-direction: column; gap: 8px; }
    .ktp-question-status { display: flex; }
}
