/* PsychoTesty v14.1 — Frontend Styles */

:root {
    --wpt-primary: #3b82f6;
    --wpt-primary-dark: #2563eb;
    --wpt-success: #22c55e;
    --wpt-warning: #f59e0b;
    --wpt-danger: #ef4444;
    --wpt-bg: #f8fafc;
    --wpt-card: #ffffff;
    --wpt-text: #1e293b;
    --wpt-muted: #64748b;
    --wpt-border: #e2e8f0;
    --wpt-radius: 12px;
    --wpt-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* ===== KONTENER TESTU ===== */
.wpt-container {
    max-width: 680px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--wpt-card);
    border-radius: var(--wpt-radius);
    box-shadow: var(--wpt-shadow);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--wpt-text);
    line-height: 1.6;
}

/* Nagłówek */
.wpt-header { text-align: center; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 2px solid var(--wpt-border); }
.wpt-title { font-size: 1.5rem; font-weight: 700; color: var(--wpt-text); margin: 0 0 0.5rem; }
.wpt-instructions { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 1rem; margin-top: 1rem; text-align: left; font-size: 0.9rem; }
.wpt-instructions strong { color: var(--wpt-primary); }

/* ===== KOD DOSTĘPU ===== */
.wpt-access-gate { text-align: center; padding: 2rem 1rem; }
.wpt-gate-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.wpt-access-gate h3 { color: var(--wpt-text); margin-bottom: 1rem; }
.wpt-gate-field { display: flex; gap: 8px; justify-content: center; max-width: 360px; margin: 0 auto; }
.wpt-gate-input { padding: 10px 16px; border: 2px solid var(--wpt-border); border-radius: 8px; font-size: 1rem; flex: 1; text-align: center; transition: border-color 0.3s; }
.wpt-gate-input:focus { border-color: var(--wpt-primary); outline: none; }
.wpt-gate-input-error { border-color: var(--wpt-danger) !important; animation: wptShake 0.4s; }

/* ===== PASEK POSTĘPU ===== */
.wpt-progress { margin-bottom: 2rem; }
.wpt-progress-bar { height: 8px; background: var(--wpt-border); border-radius: 4px; overflow: hidden; }
.wpt-progress-fill { height: 100%; background: linear-gradient(90deg, var(--wpt-primary), var(--wpt-primary-dark)); border-radius: 4px; transition: width 0.4s ease; }
.wpt-progress-text { display: block; text-align: center; margin-top: 8px; font-size: 0.85rem; color: var(--wpt-muted); font-weight: 500; }

/* ===== PYTANIE (IZOLOWANE — jedno na ekranie) ===== */
.wpt-question-stage { min-height: 200px; }

.wpt-question-active {
    animation: wptFadeIn 0.25s ease-out;
}

.wpt-question-text {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    line-height: 1.5;
    color: var(--wpt-text);
}
.wpt-q-num { color: var(--wpt-primary); font-weight: 700; }

/* Opcje odpowiedzi */
.wpt-options { display: flex; flex-direction: column; gap: 10px; }
.wpt-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--wpt-bg);
    border: 2px solid var(--wpt-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.wpt-option:hover {
    border-color: var(--wpt-primary);
    background: rgba(59,130,246,0.04);
    transform: translateX(3px);
}
.wpt-option.active {
    border-color: var(--wpt-primary);
    background: rgba(59,130,246,0.08);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.wpt-option.wpt-option-confirmed {
    border-color: var(--wpt-success);
    background: rgba(34,197,94,0.06);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}

.wpt-option input[type="radio"] { display: none; }
.wpt-option-radio {
    width: 22px; height: 22px;
    border: 2px solid var(--wpt-border);
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}
.wpt-option.active .wpt-option-radio {
    border-color: var(--wpt-primary);
    background: var(--wpt-primary);
}
.wpt-option.active .wpt-option-radio::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px;
    width: 10px; height: 10px;
    background: #fff;
    border-radius: 50%;
}
.wpt-option-confirmed .wpt-option-radio {
    border-color: var(--wpt-success) !important;
    background: var(--wpt-success) !important;
}
.wpt-option-val { font-weight: 700; color: var(--wpt-primary); font-size: 0.9rem; min-width: 18px; text-align: center; }
.wpt-option-label { flex: 1; color: var(--wpt-text); }

/* ===== NAWIGACJA ===== */
.wpt-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--wpt-border);
    gap: 12px;
}

/* Przyciski */
.wpt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 2px solid var(--wpt-border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--wpt-bg);
    color: var(--wpt-text);
    text-decoration: none;
    line-height: 1.4;
}
.wpt-btn:hover { border-color: var(--wpt-primary); color: var(--wpt-primary); }
.wpt-btn-primary { background: var(--wpt-primary); color: #fff; border-color: var(--wpt-primary); }
.wpt-btn-primary:hover { background: var(--wpt-primary-dark); border-color: var(--wpt-primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.wpt-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.wpt-btn-lg { font-size: 1.05rem; padding: 14px 28px; }
.wpt-btn-sm { font-size: 0.85rem; padding: 6px 14px; }
.wpt-btn-submit { font-size: 1.05rem; padding: 12px 28px; }

/* Wiadomości */
.wpt-message { margin-top: 12px; padding: 10px; border-radius: 8px; font-size: 0.9rem; display: none; text-align: center; }
.wpt-message.error { display: block; background: #fef2f2; color: var(--wpt-danger); border: 1px solid #fecaca; }
.wpt-message.success { display: block; background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Loading */
.wpt-loading { text-align: center; padding: 3rem; }
.wpt-spinner { width: 48px; height: 48px; border: 4px solid var(--wpt-border); border-top-color: var(--wpt-primary); border-radius: 50%; animation: wptSpin 0.7s linear infinite; margin: 0 auto 1rem; }

/* Error */
.wpt-error { text-align: center; padding: 2rem; background: #fef2f2; color: var(--wpt-danger); border: 1px solid #fecaca; border-radius: var(--wpt-radius); }

/* ===== WYNIKI ===== */
.wpt-results-display { padding: 1rem 0; }
.wpt-results-header { text-align: center; margin-bottom: 2rem; }
.wpt-results-header h2 { font-size: 1.4rem; color: var(--wpt-text); }
.wpt-results-logo { display: block; margin: 0 auto 12px; }
.wpt-results-scales { display: grid; gap: 16px; margin-bottom: 2rem; }

.wpt-result-card {
    background: var(--wpt-bg);
    border-radius: var(--wpt-radius);
    padding: 1.5rem;
    border-left: 4px solid var(--wpt-primary);
}
.wpt-result-card h3 { margin: 0 0 8px; font-size: 1rem; color: var(--wpt-muted); }
.wpt-score-big { font-size: 2.5rem; font-weight: 800; margin: 4px 0; }
.wpt-score-max { font-size: 1.2rem; font-weight: 400; color: var(--wpt-muted); }

.wpt-bar { height: 10px; background: var(--wpt-border); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.wpt-bar-fill { height: 100%; border-radius: 5px; transition: width 0.8s ease; }

.wpt-interp { padding: 10px 14px; margin-top: 8px; background: #fff; border-radius: 6px; font-size: 0.9rem; }
.wpt-interp p { margin: 4px 0 0; color: var(--wpt-muted); }

.wpt-recommendations { margin-top: 8px; font-size: 0.9rem; }
.wpt-recommendations ul { margin: 4px 0 0 16px; }

.wpt-total-result { text-align: center; padding: 1.5rem; background: var(--wpt-bg); border-radius: var(--wpt-radius); }
.wpt-total-big { font-size: 2rem; font-weight: 800; color: var(--wpt-text); }
.wpt-interp-badge { display: inline-block; padding: 6px 16px; border-radius: 20px; color: #fff; font-weight: 600; margin-top: 8px; }

.wpt-disclaimer { margin-top: 2rem; padding: 1rem; background: #fffbeb; border: 1px solid #fed7aa; border-radius: 8px; text-align: center; }
.wpt-disclaimer p { margin: 0; color: #92400e; font-size: 0.85rem; }

.wpt-thankyou { text-align: center; padding: 3rem 1rem; }
.wpt-thankyou h2 { font-size: 1.5rem; color: var(--wpt-success); }

/* ===== KAFELKI TESTÓW ===== */
.wpt-test-grid { display: grid; gap: 20px; margin: 2rem 0; }
.wpt-test-grid.wpt-cols-1 { grid-template-columns: 1fr; }
.wpt-test-grid.wpt-cols-2 { grid-template-columns: repeat(2, 1fr); }
.wpt-test-grid.wpt-cols-3 { grid-template-columns: repeat(3, 1fr); }

.wpt-test-card {
    background: var(--wpt-card);
    border-radius: var(--wpt-radius);
    padding: 1.5rem;
    box-shadow: var(--wpt-shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: center;
    cursor: pointer;
}
.wpt-test-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,0.12); }
.wpt-card-icon { font-size: 2.5rem; margin-bottom: 8px; }
.wpt-card-title { font-size: 1.15rem; font-weight: 700; color: var(--wpt-text); margin: 0 0 8px; }
.wpt-card-desc { font-size: 0.9rem; color: var(--wpt-muted); margin: 0 0 12px; flex: 1; }
.wpt-card-meta { display: flex; justify-content: center; gap: 12px; font-size: 0.8rem; color: var(--wpt-muted); margin-bottom: 8px; flex-wrap: wrap; }

/* ===== MODAL TESTU ===== */
.wpt-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}
.wpt-modal-overlay.wpt-modal-open { display: flex; }

.wpt-modal {
    background: var(--wpt-card);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    animation: wptModalIn 0.25s ease-out;
}

.wpt-modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none; border: none;
    font-size: 1.8rem;
    color: var(--wpt-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}
.wpt-modal-close:hover { color: var(--wpt-text); }

.wpt-modal-header { text-align: center; margin-bottom: 1rem; }
.wpt-modal-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.wpt-modal-header h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 6px; color: var(--wpt-text); }
.wpt-modal-slug { font-size: 0.75rem; color: var(--wpt-muted); background: var(--wpt-bg); padding: 2px 10px; border-radius: 4px; }

.wpt-modal-desc { color: var(--wpt-muted); font-size: 0.9rem; text-align: center; margin-bottom: 1.25rem; line-height: 1.5; }

.wpt-modal-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.25rem;
}
.wpt-modal-meta-item { text-align: center; padding: 10px; background: var(--wpt-bg); border-radius: 8px; }
.wpt-modal-meta-label { display: block; font-size: 0.75rem; color: var(--wpt-muted); margin-bottom: 2px; }
.wpt-modal-meta-value { display: block; font-size: 1.1rem; font-weight: 700; color: var(--wpt-text); }

.wpt-modal-tags { margin-bottom: 1.25rem; }
.wpt-modal-tags-title { font-size: 0.8rem; font-weight: 600; color: var(--wpt-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.wpt-modal-tags-list { display: flex; flex-wrap: wrap; gap: 6px; }
.wpt-modal-tag { display: inline-block; padding: 4px 12px; background: #eff6ff; color: var(--wpt-primary); border-radius: 20px; font-size: 0.8rem; font-weight: 500; }

.wpt-modal-code { background: var(--wpt-bg); padding: 1rem; border-radius: 8px; margin-bottom: 1.25rem; }
.wpt-modal-code > span { font-size: 0.9rem; font-weight: 500; display: block; margin-bottom: 8px; }
.wpt-modal-code-field { display: flex; gap: 8px; }
.wpt-modal-code-input { flex: 1; padding: 8px 12px; border: 2px solid var(--wpt-border); border-radius: 6px; font-size: 0.9rem; }

.wpt-modal-actions { text-align: center; margin-top: 1.5rem; }

.wpt-empty { text-align: center; padding: 2rem; color: var(--wpt-muted); }

/* Animacje */
@keyframes wptFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes wptSpin { to { transform: rotate(360deg); } }
@keyframes wptShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes wptModalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Responsive */
@media (max-width: 640px) {
    .wpt-container { padding: 1rem; margin: 1rem; }
    .wpt-test-grid.wpt-cols-3,
    .wpt-test-grid.wpt-cols-2 { grid-template-columns: 1fr; }
    .wpt-modal { padding: 1.5rem; }
    .wpt-modal-meta { grid-template-columns: 1fr; }
    .wpt-nav { flex-wrap: wrap; }
    .wpt-btn-submit { width: 100%; justify-content: center; }
}
