/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes pmaFadeUp {
    from { opacity: 0; transform: translateY(20px); filter: blur(5px); }
    to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes pmaShimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
@keyframes pmaFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes pmaPulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(205,172,101,0.4); }
    50% { box-shadow: 0 0 20px 4px rgba(205,172,101,0.2); }
}
@keyframes pmaAiDot {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Wrap ─────────────────────────────────────────────────────────────────── */
.pma-survey-wrap {
    font-family: 'Inter', sans-serif;
    max-width: 720px;
    margin: 20px auto;
    padding: 40px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
}
.pma-survey-wrap::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(205,172,101,0.06) 0%, rgba(255,255,255,0) 60%);
    z-index: -1;
    pointer-events: none;
}
.pma-survey-wrap *, .pma-survey-wrap *::before, .pma-survey-wrap *::after { box-sizing: border-box; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.pma-progress-bar-wrap {
    height: 8px;
    background: rgba(229, 231, 235, 0.5);
    border-radius: 99px;
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.pma-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #CDAC65, #E8D4A2, #CDAC65);
    background-size: 200% auto;
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: pmaShimmer 3s linear infinite;
}
.pma-progress-label {
    text-align: right;
    font-size: 13px;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 36px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Steps ────────────────────────────────────────────────────────────────── */
.pma-step { display: none; animation: pmaFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.pma-step.pma-step-active { display: block; }

/* ── Step header ──────────────────────────────────────────────────────────── */
.pma-step-header { margin-bottom: 32px; }
.pma-survey-icon { 
    font-size: 48px; 
    margin-bottom: 16px; 
    display: inline-block;
    animation: pmaFloat 6s ease-in-out infinite;
}
.pma-survey-title {
    font-size: 30px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 12px;
    line-height: 1.2;
    background: linear-gradient(135deg, #111827, #374151);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.pma-survey-desc {
    font-size: 17px;
    color: #4b5563;
    margin: 0;
    line-height: 1.6;
}
.pma-q-number {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    color: #CDAC65;
    background: linear-gradient(135deg, #FCF9F2, #fff);
    padding: 6px 16px;
    border-radius: 99px;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(205,172,101,0.15);
    border: 1px solid rgba(205,172,101,0.2);
}
.pma-q-number::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    background: #CDAC65;
    border-radius: 50%;
    margin-right: 8px;
    animation: pmaPulseGlow 2s infinite;
}
.pma-q-text {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.4;
}
.pma-required { color: #ef4444; margin-left: 4px; font-weight: 800; }

/* ── Fields ───────────────────────────────────────────────────────────────── */
.pma-field { margin-bottom: 24px; }
.pma-field label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}
.pma-field input[type="text"],
.pma-field input[type="email"],
.pma-field textarea,
.pma-field select {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid rgba(229, 231, 235, 0.8);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
    color: #111827;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    appearance: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.pma-field input:focus,
.pma-field textarea:focus,
.pma-field select:focus {
    border-color: #CDAC65;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(205,172,101,0.15), 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}
.pma-field textarea { resize: vertical; min-height: 120px; }

/* ── Option cards (radio / checkbox) ─────────────────────────────────────── */
.pma-options-field { display: flex; flex-direction: column; gap: 12px; }
.pma-option-label {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 2px solid rgba(229, 231, 235, 0.8);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    color: #4b5563;
    background: rgba(255, 255, 255, 0.7);
}
.pma-option-label:hover { 
    border-color: #E8D4A2; 
    background: rgba(252, 249, 242, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.pma-option-label input[type="radio"],
.pma-option-label input[type="checkbox"] { 
    width: 20px; height: 20px; 
    accent-color: #CDAC65; 
    flex-shrink: 0; 
    cursor: pointer;
    transition: transform 0.2s;
}
.pma-option-label:has(input:checked) {
    border-color: #CDAC65;
    background: #FCF9F2;
    color: #111827;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(205,172,101,0.12);
}
.pma-option-label:has(input:checked) input {
    transform: scale(1.1);
}

/* ── Scale ────────────────────────────────────────────────────────────────── */
.pma-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 12px;
}
.pma-scale-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.pma-scale-btn {
    flex: 1;
    min-width: 44px;
    padding: 14px 4px;
    border: 2px solid rgba(229, 231, 235, 0.8);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}
.pma-scale-btn:hover { 
    border-color: #E8D4A2; 
    color: #CDAC65; 
    background: #FCF9F2; 
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(205,172,101,0.15);
}
.pma-scale-btn.active { 
    border-color: #CDAC65; 
    background: linear-gradient(135deg, #CDAC65, #B89650); 
    color: #fff; 
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 16px rgba(205,172,101,0.3);
}

/* ── Navigation ───────────────────────────────────────────────────────────── */
.pma-step-nav {
    display: flex;
    gap: 16px;
    margin-top: 40px;
}
.pma-btn-primary, .pma-btn-ghost {
    padding: 16px 32px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pma-btn-primary {
    background: linear-gradient(135deg, #CDAC65, #B89650);
    color: #fff;
    box-shadow: 0 8px 20px rgba(205,172,101,0.3);
    position: relative;
    overflow: hidden;
}
.pma-btn-primary::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,0.3), rgba(255,255,255,0));
    transform: rotate(45deg) translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.pma-btn-primary:hover::after {
    transform: rotate(45deg) translateY(100%);
}
.pma-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(205,172,101,0.4);
}
.pma-btn-primary:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(205,172,101,0.3); }
.pma-btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; box-shadow: none; }
.pma-btn-ghost {
    background: rgba(255,255,255,0.8);
    color: #4b5563;
    border-color: #e5e7eb;
}
.pma-btn-ghost:hover { 
    border-color: #CDAC65; 
    color: #CDAC65; 
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

/* ── AI Loading State ─────────────────────────────────────────────────────── */
.pma-ai-loader {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 10px;
}
.pma-ai-dot {
    width: 6px; height: 6px;
    background-color: #fff;
    border-radius: 50%;
    animation: pmaAiDot 1.4s infinite ease-in-out both;
}
.pma-ai-dot:nth-child(1) { animation-delay: -0.32s; }
.pma-ai-dot:nth-child(2) { animation-delay: -0.16s; }

/* ── Error ────────────────────────────────────────────────────────────────── */
.pma-error-msg {
    background: rgba(254, 242, 242, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid #fecaca;
    border-radius: 14px;
    padding: 16px 24px;
    color: #dc2626;
    font-size: 15px;
    font-weight: 500;
    margin-top: 24px;
    animation: pmaFadeUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.pma-error-msg::before {
    content: '⚠️';
}

/* ── Result card ──────────────────────────────────────────────────────────── */
.pma-result {
    text-align: center;
    animation: pmaFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.pma-result-card {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 28px;
    padding: 56px 40px;
    box-shadow: 0 24px 50px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}
.pma-result-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
}
.pma-result-card.pma-tier-gold::before     { background: linear-gradient(90deg,#CDAC65,#F5D060,#CDAC65); background-size: 200%; animation: pmaShimmer 3s infinite linear; }
.pma-result-card.pma-tier-diamond::before  { background: linear-gradient(90deg,#4f93ce,#a8d8ea,#4f93ce); background-size: 200%; animation: pmaShimmer 3s infinite linear; }
.pma-result-card.pma-tier-mastermind::before { background: linear-gradient(90deg,#7b5ea7,#c89fe0,#7b5ea7); background-size: 200%; animation: pmaShimmer 3s infinite linear; }
.pma-result-card.pma-tier-operator-mastermind::before { background: linear-gradient(90deg,#1e3a8a,#3b82f6,#1e3a8a); background-size: 200%; animation: pmaShimmer 3s infinite linear; }

.pma-glow-bg {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(205,172,101,0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    filter: blur(30px);
    animation: pmaPulseGlow 4s infinite alternate;
    z-index: 0;
}
.pma-result-card > *:not(.pma-glow-bg) { position: relative; z-index: 1; }

.pma-result-confetti { font-size: 56px; margin-bottom: 16px; animation: pmaFloat 4s ease-in-out infinite; }
.pma-result-headline { font-size: 14px; font-weight: 700; color: #CDAC65; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px; }
.pma-result-tier {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 42px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 16px;
    line-height: 1.1;
    clear: both;
}
.pma-result-tier .pma-tier-icon { font-size: 38px; margin-right: 12px; vertical-align: middle; }
.pma-confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 32px auto;
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.pma-confidence-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pma-confidence-high   { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.pma-confidence-high::before { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.pma-confidence-medium { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }
.pma-confidence-medium::before { background: #eab308; box-shadow: 0 0 8px #eab308; }
.pma-confidence-low    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.pma-confidence-low::before { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

.pma-result-divider { width: 80px; height: 4px; background: linear-gradient(90deg, transparent, #e5e7eb, transparent); margin: 0 auto 32px; }
.pma-result-explanation {
    font-size: 17px;
    color: #4b5563;
    line-height: 1.8;
    margin-bottom: 40px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.pma-result-ctas {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 480px;
    margin: 32px auto 0 auto;
    align-items: center;
    justify-content: center;
}

.pma-result-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    cursor: pointer;
    border: 2px solid transparent;
}

/* Primary style (Gold gradient) */
.pma-result-cta.pma-cta-primary {
    background: linear-gradient(135deg,#CDAC65,#B89650);
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(205,172,101,0.25);
}
.pma-result-cta.pma-cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(205,172,101,0.35);
    color: #fff !important;
}

/* Secondary style (Dark Slate) */
.pma-result-cta.pma-cta-secondary {
    background: #111827;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.15);
}
.pma-result-cta.pma-cta-secondary:hover {
    background: #1f2937;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.25);
    color: #fff !important;
}

/* Tertiary style (Outline / Link) */
.pma-result-cta.pma-cta-tertiary {
    background: transparent;
    border-color: #CDAC65;
    color: #CDAC65 !important;
    box-shadow: none;
}
.pma-result-cta.pma-cta-tertiary:hover {
    background: rgba(205, 172, 101, 0.05);
    transform: translateY(-2px);
    color: #B89650 !important;
    border-color: #B89650;
}

@media (min-width: 641px) {
    .pma-result-ctas {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: 100%;
        gap: 16px;
    }
    .pma-result-cta {
        width: auto;
    }
}
.pma-result-restart {
    display: inline-block;
    margin-top: 24px;
    font-size: 14px;
    font-weight: 600;
    color: #9ca3af;
    cursor: pointer;
    text-decoration: none;
    background: none;
    border: none;
    font-family: inherit;
    transition: color 0.2s;
    padding: 8px 16px;
}
.pma-result-restart:hover { color: #4b5563; }

/* ── Notice ───────────────────────────────────────────────────────────────── */
.pma-notice {
    padding: 16px 20px;
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 12px;
    font-size: 15px;
    color: #78350f;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.pma-notice::before { content: '💡'; font-size: 20px; }

/* ── Validation Errors ────────────────────────────────────────────────────── */
.pma-invalid {
    border-color: #ef4444 !important;
    background-color: rgba(254, 242, 242, 0.4) !important;
}
.pma-invalid-scale .pma-scale-btn {
    border-color: #ef4444 !important;
    background-color: rgba(254, 242, 242, 0.4) !important;
}
.pma-invalid-group .pma-option-label {
    border-color: #ef4444 !important;
    background-color: rgba(254, 242, 242, 0.4) !important;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .pma-survey-wrap { padding: 24px 20px; border-radius: 16px; margin: 10px auto; }
    .pma-survey-title { font-size: 24px; }
    .pma-q-text       { font-size: 20px; }
    .pma-result-card  { padding: 40px 24px; }
    .pma-result-tier  { font-size: 32px; }
    .pma-scale-btn    { min-width: 36px; padding: 12px 2px; font-size: 14px; }
    .pma-btn-primary, .pma-btn-ghost { padding: 14px 24px; font-size: 15px; }
    .pma-step-nav { flex-direction: column; }
    .pma-btn-primary { width: 100%; }
}
