/* ========================================
   Psych Scales - Frontend v3.1
   Self-contained theme - works on any background
   ======================================== */

/* === Astra Theme Compatibility === */
/* Force full-width layout within Astra's container */
.ast-separate-container .psych-scale-single,
.ast-separate-container .psych-archive,
.ast-plain-container .psych-scale-single,
.ast-plain-container .psych-archive {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Override Astra's content area restrictions */
.site-content .psych-scale-single,
.site-content .psych-archive,
#primary .psych-scale-single,
#primary .psych-archive,
.entry-content .psych-scale-single,
.entry-content .psych-archive {
    max-width: 100%;
    width: 100%;
    float: none;
    margin: 0 auto;
}

/* Remove Astra's page padding/margin that pushes content */
.ast-separate-container .ast-article-single:has(.psych-scale-single),
.ast-separate-container .ast-article-post:has(.psych-scale-single) {
    padding: 0;
    margin: 0;
    background: transparent;
}

/* Fallback for themes without :has() support */
body.single-psych_scale .site-content,
body.single-psych_scale #primary,
body.post-type-archive-psych_scale .site-content,
body.post-type-archive-psych_scale #primary {
    width: 100%;
    max-width: 100%;
    float: none;
    padding: 0;
    margin: 0 auto;
}

body.single-psych_scale #secondary,
body.post-type-archive-psych_scale #secondary {
    display: none;
}

body.single-psych_scale .ast-container,
body.post-type-archive-psych_scale .ast-container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

body.single-psych_scale .entry-content,
body.post-type-archive-psych_scale .site-main {
    max-width: 100%;
    width: 100%;
}

body.single-psych_scale .ast-article-single,
body.single-psych_scale .ast-article-post {
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border: none;
}

/* Astra breadcrumb alignment */
body.single-psych_scale .ast-breadcrumbs-wrapper,
body.post-type-archive-psych_scale .ast-breadcrumbs-wrapper,
body.single-psych_scale .ast-breadcrumbs,
body.post-type-archive-psych_scale .ast-breadcrumbs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
}

/* Scope ALL variables to our containers so they override the theme */
.psych-scale-single,
.psych-archive,
.psych-scale-embedded {
    --psych-primary: #6366f1;
    --psych-primary-light: #4f46e5;
    --psych-primary-dark: #4338ca;
    --psych-primary-bg: #eef2ff;
    --psych-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --psych-gradient-soft: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%);
    --psych-success: #10b981;
    --psych-success-bg: #ecfdf5;
    --psych-warning: #f59e0b;
    --psych-danger: #ef4444;
    --psych-text: #1e293b;
    --psych-text-secondary: #334155;
    --psych-text-muted: #64748b;
    --psych-text-light: #94a3b8;
    --psych-bg: #f8fafc;
    --psych-surface: #ffffff;
    --psych-surface-hover: #f8fafc;
    --psych-border: #e2e8f0;
    --psych-border-light: #f1f5f9;
    --psych-radius: 16px;
    --psych-radius-sm: 10px;
    --psych-radius-full: 9999px;
    --psych-shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --psych-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    --psych-shadow-md: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.06);
    --psych-shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.06);
    --psych-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --psych-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Reset inherited styles from parent theme */
    font-family: var(--psych-font);
    color: var(--psych-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* Full width within parent container */
    width: 100%;
    max-width: 100%;
    float: none;
    margin-left: auto;
    margin-right: auto;
}

/* ============================
   SINGLE SCALE PAGE
   ============================ */

.psych-scale-single {
    max-width: 100%;
}

/* Hero Section */
.psych-hero {
    position: relative;
    padding: 60px 20px 50px;
    text-align: center;
    overflow: hidden;
    background: var(--psych-gradient);
    border-radius: var(--psych-radius);
    margin: 0 auto 30px;
    max-width: 760px;
}

/* Info Button in Hero */
.psych-hero-info-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--psych-transition);
    font-family: var(--psych-font);
}

.psych-hero-info-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.psych-hero-info-btn svg {
    stroke: currentColor;
    opacity: 0.9;
}

/* Info Panel (hidden by default) */
.psych-scale-info-panel {
    max-width: 760px;
    margin: 0 auto 24px;
    padding: 0 20px;
    animation: psych-slide-down 0.3s ease;
}

@keyframes psych-slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.psych-scale-info-panel-inner {
    background: var(--psych-surface);
    border: 1px solid var(--psych-border);
    border-radius: var(--psych-radius-sm);
    box-shadow: var(--psych-shadow);
    overflow: hidden;
}

.psych-scale-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--psych-primary-bg);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.psych-scale-info-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--psych-primary-dark);
    flex: 1;
}

.psych-scale-info-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--psych-text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: var(--psych-transition);
}

.psych-scale-info-close:hover {
    color: var(--psych-danger);
}

.psych-scale-info-content {
    padding: 18px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--psych-text-secondary);
}

.psych-scale-info-content p {
    margin: 0 0 10px;
}

.psych-scale-info-content p:last-child {
    margin-bottom: 0;
}

.psych-hero-bg {
    display: none;
}

.psych-hero-content {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    z-index: 1;
}

.psych-hero-cats {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.psych-hero-tag {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 5px 14px;
    border-radius: var(--psych-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--psych-transition);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

.psych-hero-tag:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.psych-hero-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    color: #ffffff !important;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.psych-hero-desc {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 24px;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
}

.psych-hero-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.psych-hero-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
}

.psych-hero-meta-item svg {
    opacity: 0.8;
    stroke: rgba(255, 255, 255, 0.8);
}

/* Scale Content */
.psych-scale-content {
    max-width: 700px;
    margin: 0 auto 30px;
    padding: 0 20px;
    font-size: 1.05rem;
    color: var(--psych-text-muted);
    line-height: 1.8;
}

/* Body */
.psych-scale-body {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* Gate (Login / Info) */
.psych-gate {
    text-align: center;
    padding: 50px 30px;
    background: var(--psych-surface);
    border-radius: var(--psych-radius);
    box-shadow: var(--psych-shadow);
    border: 1px solid var(--psych-border);
}

.psych-gate-icon {
    margin-bottom: 20px;
}

.psych-gate-icon svg {
    stroke: var(--psych-primary);
}

.psych-gate h3 {
    font-size: 1.4rem;
    color: var(--psych-text);
    margin: 0 0 8px;
}

.psych-gate p {
    color: var(--psych-text-muted);
    margin: 0 0 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.psych-gate-fields {
    max-width: 380px;
    margin: 0 auto 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.psych-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--psych-text-secondary);
    margin-bottom: 6px;
    text-align: left;
}

.psych-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--psych-border);
    border-radius: var(--psych-radius-sm);
    font-size: 1rem;
    transition: var(--psych-transition);
    box-sizing: border-box;
    background: var(--psych-surface);
    color: var(--psych-text);
}

.psych-field input::placeholder {
    color: var(--psych-text-light);
}

.psych-field input:focus {
    outline: none;
    border-color: var(--psych-primary);
    background: var(--psych-surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Buttons */
.psych-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--psych-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--psych-transition);
    text-decoration: none;
    line-height: 1.4;
    font-family: var(--psych-font);
}

.psych-btn-primary {
    background: var(--psych-gradient);
    color: white !important;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.psych-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    color: white !important;
}

.psych-btn-primary:active {
    transform: translateY(0);
}

.psych-btn-lg {
    padding: 16px 32px;
    font-size: 1.05rem;
}

.psych-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Floating Progress Bar */
.psych-floating-progress {
    position: sticky;
    top: 0;
    z-index: 1000;
    margin: 0 -20px 30px;
    padding: 0 20px;
}

.psych-fp-inner {
    background: var(--psych-surface);
    border-radius: 0 0 var(--psych-radius-sm) var(--psych-radius-sm);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--psych-shadow-md);
    border: 1px solid var(--psych-border);
    border-top: none;
}

.psych-fp-bar {
    flex: 1;
    height: 6px;
    background: var(--psych-border);
    border-radius: 3px;
    overflow: hidden;
}

.psych-fp-fill {
    height: 100%;
    background: var(--psych-gradient);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.psych-fp-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--psych-text-muted);
    white-space: nowrap;
}

.psych-fp-timer {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--psych-primary);
    padding: 4px 10px;
    background: var(--psych-primary-bg);
    border-radius: var(--psych-radius-full);
}

.psych-fp-timer.timer-warning {
    color: var(--psych-danger);
    background: rgba(239, 68, 68, 0.1);
    animation: psych-pulse 1s infinite;
}

@keyframes psych-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Instructions Card */
.psych-instructions-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    background: var(--psych-primary-bg);
    border-radius: var(--psych-radius-sm);
    margin-bottom: 30px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.psych-instructions-card svg {
    flex-shrink: 0;
    margin-top: 2px;
    stroke: var(--psych-primary);
}

.psych-instructions-text strong {
    display: block;
    color: var(--psych-primary);
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.psych-instructions-text p {
    margin: 0;
    color: var(--psych-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Response Legend */
.psych-legend {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 30px;
    padding: 14px 16px;
    background: var(--psych-surface);
    border-radius: var(--psych-radius-sm);
    border: 1px solid var(--psych-border);
    flex-wrap: wrap;
}

.psych-legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    min-width: 60px;
}

.psych-legend-value {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--psych-primary-bg);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--psych-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.psych-legend-label {
    font-size: 0.7rem;
    color: var(--psych-text-muted);
    text-align: center;
    max-width: 70px;
}

/* Scale Items */
.psych-items-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psych-item {
    background: var(--psych-surface);
    border-radius: var(--psych-radius-sm);
    padding: 22px 24px;
    border: 1px solid var(--psych-border);
    transition: var(--psych-transition);
    animation: psych-item-in 0.3s ease forwards;
    opacity: 0;
    transform: translateY(8px);
    box-shadow: var(--psych-shadow-sm);
}

@keyframes psych-item-in {
    to { opacity: 1; transform: translateY(0); }
}

.psych-item:nth-child(1) { animation-delay: 0.02s; }
.psych-item:nth-child(2) { animation-delay: 0.04s; }
.psych-item:nth-child(3) { animation-delay: 0.06s; }
.psych-item:nth-child(4) { animation-delay: 0.08s; }
.psych-item:nth-child(5) { animation-delay: 0.1s; }
.psych-item:nth-child(n+6) { animation-delay: 0.12s; }

.psych-item:hover {
    border-color: var(--psych-primary);
    background: var(--psych-surface-hover);
}

.psych-item.psych-item-answered {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
}

.psych-item.psych-item-error {
    border-color: var(--psych-danger);
    background: rgba(239, 68, 68, 0.05);
    animation: psych-shake 0.4s ease;
}

@keyframes psych-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.psych-item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.psych-item-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: var(--psych-primary-bg);
    color: var(--psych-primary);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.psych-item-answered .psych-item-num {
    background: var(--psych-primary);
    color: white;
    border-color: var(--psych-primary);
}

.psych-item-question {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--psych-text);
    line-height: 1.5;
    padding-top: 4px;
}

/* Response Options */
.psych-item-responses {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 44px;
    justify-content: center;
}

.psych-response {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 2px solid var(--psych-border);
    border-radius: var(--psych-radius-full);
    cursor: pointer;
    transition: var(--psych-transition);
    user-select: none;
    position: relative;
    background: var(--psych-surface);
}

.psych-response:hover {
    border-color: var(--psych-primary-light);
    background: var(--psych-primary-bg);
}

.psych-response:focus-visible {
    outline: 2px solid var(--psych-primary);
    outline-offset: 2px;
}

.psych-response input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.psych-response-indicator {
    width: 18px;
    height: 18px;
    border: 2px solid var(--psych-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--psych-transition);
    flex-shrink: 0;
    background: transparent;
}

.psych-response-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    transition: var(--psych-transition);
    transform: scale(0);
}

.psych-response-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--psych-text-secondary);
    transition: var(--psych-transition);
}

/* Selected state - using :has() */
.psych-response:has(input:checked) {
    border-color: var(--psych-primary);
    background: var(--psych-primary-bg);
}

.psych-response:has(input:checked) .psych-response-indicator {
    border-color: var(--psych-primary);
}

.psych-response:has(input:checked) .psych-response-dot {
    background: var(--psych-primary);
    transform: scale(1);
}

.psych-response:has(input:checked) .psych-response-label {
    color: var(--psych-primary-dark);
    font-weight: 600;
}

/* Fallback for browsers without :has() */
.psych-response.is-selected {
    border-color: var(--psych-primary);
    background: var(--psych-primary-bg);
}

.psych-response.is-selected .psych-response-indicator {
    border-color: var(--psych-primary);
}

.psych-response.is-selected .psych-response-dot {
    background: var(--psych-primary);
    transform: scale(1);
}

.psych-response.is-selected .psych-response-label {
    color: var(--psych-primary-dark);
    font-weight: 600;
}

/* Submit Section */
.psych-submit-section {
    margin-top: 40px;
    padding: 30px;
    background: var(--psych-surface);
    border-radius: var(--psych-radius);
    border: 1px solid var(--psych-border);
    text-align: center;
    box-shadow: var(--psych-shadow-sm);
}

.psych-submit-check {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 16px;
    font-size: 0.9rem;
    color: var(--psych-text-light);
}

.psych-submit-check svg {
    stroke: var(--psych-text-light);
}

.psych-submit-check.all-answered {
    color: var(--psych-success);
}

.psych-submit-check.all-answered svg {
    stroke: var(--psych-success);
}

.psych-btn-submit {
    min-width: 220px;
}

.psych-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: psych-spin 0.6s linear infinite;
}

@keyframes psych-spin {
    to { transform: rotate(360deg); }
}

/* Page Nav (pagination within test) */
.psych-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
    padding: 16px;
    background: var(--psych-surface);
    border-radius: var(--psych-radius-sm);
    border: 1px solid var(--psych-border);
}

.psych-page-info {
    font-weight: 600;
    color: var(--psych-text-muted);
    font-size: 0.9rem;
}

.psych-page-info strong {
    color: var(--psych-primary);
}

.psych-page-prev,
.psych-page-next {
    padding: 8px 18px;
    font-size: 0.88rem;
}

/* ============================
   RESULTS PANEL
   ============================ */

.psych-results-panel {
    animation: psych-results-in 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes psych-results-in {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.psych-results-inner {
    background: var(--psych-surface);
    border-radius: var(--psych-radius);
    overflow: hidden;
    box-shadow: var(--psych-shadow-lg);
    border: 1px solid var(--psych-border);
}

.psych-results-header {
    position: relative;
    background: var(--psych-gradient);
    padding: 40px 30px 30px;
    text-align: center;
    color: white;
    overflow: hidden;
}

.psych-results-header h2 {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 700;
    color: white !important;
}

.psych-results-subtitle {
    margin: 0;
    opacity: 0.85;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
}

.psych-results-body {
    padding: 30px;
}

.psych-results-footer {
    padding: 20px 30px 30px;
}

/* Score Display */
.psych-score-display {
    text-align: center;
    margin-bottom: 30px;
}

.psych-score-circle {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 16px;
}

.psych-score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.psych-score-circle .circle-bg {
    fill: none;
    stroke: var(--psych-border);
    stroke-width: 8;
}

.psych-score-circle .circle-fill {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 408;
    stroke-dashoffset: 408;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.psych-score-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.psych-score-number {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--psych-text);
    line-height: 1;
}

.psych-score-label {
    font-size: 0.8rem;
    color: var(--psych-text-light);
    font-weight: 500;
    margin-top: 4px;
}

/* Interpretation Badge */
.psych-interpretation {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--psych-primary-bg);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--psych-radius-full);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--psych-primary-dark);
    margin-bottom: 20px;
}

/* Stats Row */
.psych-stats-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.psych-stat-item {
    text-align: center;
    padding: 16px 20px;
    background: var(--psych-bg);
    border-radius: var(--psych-radius-sm);
    min-width: 100px;
    border: 1px solid var(--psych-border);
}

.psych-stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--psych-text);
}

.psych-stat-label {
    font-size: 0.75rem;
    color: var(--psych-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Subscale Bars */
.psych-subscales-section {
    margin-top: 24px;
}

.psych-subscales-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--psych-text);
    margin: 0 0 16px;
}

.psych-subscale-bar {
    margin-bottom: 14px;
}

.psych-subscale-bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.psych-subscale-bar-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--psych-text);
}

.psych-subscale-bar-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--psych-primary);
}

.psych-subscale-bar-track {
    height: 8px;
    background: var(--psych-border);
    border-radius: 4px;
    overflow: hidden;
}

.psych-subscale-bar-fill {
    height: 100%;
    background: var(--psych-gradient);
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* Completion Message */
.psych-completion-msg {
    padding: 16px 20px;
    background: var(--psych-success-bg);
    border-radius: var(--psych-radius-sm);
    color: var(--psych-success);
    font-weight: 500;
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Result Actions */
.psych-result-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.psych-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--psych-surface);
    border: 2px solid var(--psych-border);
    border-radius: var(--psych-radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--psych-text-muted);
    cursor: pointer;
    transition: var(--psych-transition);
    font-family: var(--psych-font);
}

.psych-action-btn:hover {
    border-color: var(--psych-primary);
    color: var(--psych-primary);
    background: var(--psych-primary-bg);
}

.psych-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Email Form in Results */
.psych-email-inline {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--psych-border);
}

.psych-email-inline input {
    padding: 10px 16px;
    border: 2px solid var(--psych-border);
    border-radius: var(--psych-radius-full);
    font-size: 0.9rem;
    width: 250px;
    transition: var(--psych-transition);
    background: var(--psych-surface);
    color: var(--psych-text);
}

.psych-email-inline input::placeholder {
    color: var(--psych-text-light);
}

.psych-email-inline input:focus {
    outline: none;
    border-color: var(--psych-primary);
}

.psych-email-inline .psych-btn {
    border-radius: var(--psych-radius-full);
}

/* Confetti */
.psych-results-celebration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.psych-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: psych-confetti-fall 3s ease-out forwards;
    opacity: 0;
}

@keyframes psych-confetti-fall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(200px) rotate(720deg); opacity: 0; }
}

/* ============================
   ARCHIVE PAGE
   ============================ */

.psych-archive {
    font-family: var(--psych-font);
}

.psych-archive-hero {
    position: relative;
    padding: 70px 20px 50px;
    text-align: center;
    overflow: hidden;
    background: var(--psych-gradient);
    border-radius: var(--psych-radius);
    margin: 0 auto 30px;
    max-width: 1200px;
}

.psych-archive-hero-bg {
    display: none;
}

.psych-archive-hero-content {
    position: relative;
    max-width: 650px;
    margin: 0 auto;
}

.psych-archive-hero-title {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    color: #ffffff !important;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.psych-archive-hero-desc {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 24px;
    line-height: 1.6;
}

.psych-archive-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.psych-archive-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.psych-archive-stat-num {
    font-size: 2rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.95);
}

.psych-archive-stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Category Filters */
.psych-archive-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 30px;
    max-width: 800px;
    margin: 0 auto;
}

.psych-filter-chip {
    padding: 8px 18px;
    background: var(--psych-surface);
    border: 1px solid var(--psych-border);
    border-radius: var(--psych-radius-full);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--psych-text-muted);
    text-decoration: none;
    transition: var(--psych-transition);
}

.psych-filter-chip:hover {
    border-color: var(--psych-primary);
    color: var(--psych-primary);
    background: var(--psych-primary-bg);
}

.psych-filter-active {
    background: var(--psych-primary) !important;
    border-color: var(--psych-primary) !important;
    color: white !important;
}

/* Cards Grid */
.psych-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.psych-card {
    background: var(--psych-surface);
    border-radius: var(--psych-radius);
    overflow: hidden;
    border: 1px solid var(--psych-border);
    box-shadow: var(--psych-shadow-sm);
    transition: var(--psych-transition);
    display: flex;
    flex-direction: column;
}

.psych-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--psych-shadow-lg);
    border-color: var(--psych-primary);
}

.psych-card-visual {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.psych-card-img-link {
    display: block;
    width: 100%;
    height: 100%;
}

.psych-card-img-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.psych-card:hover .psych-card-img-link img {
    transform: scale(1.05);
}

.psych-card-img-placeholder {
    background: var(--psych-gradient-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}

.psych-card-img-placeholder svg {
    stroke: var(--psych-text-light);
}

.psych-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 4px 12px;
    border-radius: var(--psych-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--psych-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: var(--psych-shadow-sm);
}

.psych-card-body {
    padding: 20px;
    flex: 1;
}

.psych-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}

.psych-card-title a {
    color: var(--psych-text);
    text-decoration: none;
    transition: color var(--psych-transition);
}

.psych-card-title a:hover {
    color: var(--psych-primary);
}

.psych-card-desc {
    font-size: 0.9rem;
    color: var(--psych-text-muted);
    margin: 0 0 16px;
    line-height: 1.5;
}

.psych-card-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.psych-card-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--psych-text-light);
}

.psych-card-stat svg {
    opacity: 0.6;
    stroke: var(--psych-text-light);
}

.psych-card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--psych-border);
}

.psych-card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--psych-primary-bg);
    color: var(--psych-primary);
    border-radius: var(--psych-radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--psych-transition);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.psych-card-cta:hover {
    background: var(--psych-primary);
    color: white;
    border-color: var(--psych-primary);
}

.psych-card-cta svg {
    stroke: currentColor;
}

/* Archive Pagination */
.psych-archive-nav {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    text-align: center;
}

.psych-archive-nav .nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.psych-archive-nav .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--psych-radius-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--psych-text-muted);
    border: 1px solid var(--psych-border);
    transition: var(--psych-transition);
}

.psych-archive-nav .page-numbers:hover {
    border-color: var(--psych-primary);
    color: var(--psych-primary);
}

.psych-archive-nav .page-numbers.current {
    background: var(--psych-primary);
    border-color: var(--psych-primary);
    color: white;
}

.psych-archive-nav .prev,
.psych-archive-nav .next {
    gap: 6px;
}

.psych-archive-nav .prev svg,
.psych-archive-nav .next svg {
    stroke: currentColor;
}

/* Archive Empty */
.psych-archive-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--psych-text-light);
}

.psych-archive-empty svg {
    stroke: var(--psych-text-light);
}

.psych-archive-empty h3 {
    color: var(--psych-text-muted);
    margin: 16px 0 8px;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 768px) {
    .psych-hero {
        padding: 40px 16px 35px;
    }

    .psych-hero-title {
        font-size: 1.6rem;
    }

    .psych-hero-meta {
        gap: 16px;
    }

    .psych-scale-body {
        padding: 0 12px 40px;
    }

    .psych-item {
        padding: 16px;
    }

    .psych-item-responses {
        padding-left: 0;
        flex-direction: column;
        gap: 6px;
    }

    .psych-response {
        padding: 12px 16px;
    }

    .psych-legend {
        overflow-x: auto;
        justify-content: flex-start;
        gap: 0;
    }

    .psych-floating-progress {
        margin: 0 -12px 20px;
        padding: 0 12px;
    }

    .psych-fp-inner {
        padding: 10px 14px;
    }

    .psych-archive-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .psych-card-visual {
        height: 150px;
    }

    .psych-submit-section {
        padding: 20px;
    }

    .psych-result-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .psych-action-btn {
        justify-content: center;
    }

    .psych-email-inline {
        flex-direction: column;
    }

    .psych-email-inline input {
        width: 100%;
    }

    .psych-stats-row {
        gap: 10px;
    }

    .psych-stat-item {
        flex: 1;
        min-width: 80px;
        padding: 12px;
    }

    .psych-results-body,
    .psych-results-footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .psych-hero-meta {
        flex-direction: column;
        gap: 8px;
    }

    .psych-item-header {
        flex-direction: column;
        gap: 8px;
    }

    .psych-item-num {
        align-self: flex-start;
    }
}

/* ============================
   PRINT STYLES
   ============================ */

@media print {
    .psych-floating-progress,
    .psych-scale-form,
    .psych-results-footer,
    .psych-hero-bg,
    .psych-archive-hero-bg {
        display: none !important;
    }

    .psych-results-panel {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    .psych-scale-single,
    .psych-archive {
        --psych-text: #1e293b;
        --psych-text-secondary: #334155;
        --psych-text-muted: #64748b;
        --psych-surface: #fff;
        --psych-bg: #f8fafc;
        --psych-border: #e2e8f0;
    }
}


/* Demographics Section */
.psych-demographics-section { background:#f8fafc; border:1px solid #e2e8f0; border-radius:12px; padding:24px; margin-bottom:24px; }
.psych-demo-header { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.psych-demo-header strong { font-size:16px; color:#1e293b; }
.psych-demo-desc { font-size:13px; color:#64748b; margin:0 0 16px; }
.psych-demo-fields { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:16px; }
.psych-demo-field label { display:block; font-size:12px; font-weight:600; color:#475569; margin-bottom:4px; }
.psych-demo-field select, .psych-demo-field input { width:100%; padding:10px 12px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; transition:border-color 0.2s; }
.psych-demo-field select:focus, .psych-demo-field input:focus { border-color:#667eea; outline:none; box-shadow:0 0 0 3px rgba(102,126,234,0.1); }


/* ============================
   AI INTERPRETATION SECTION
   ============================ */

.psych-ai-interpretation-section {
    margin-top: 30px;
    background: var(--psych-surface);
    border-radius: var(--psych-radius);
    border: 1px solid rgba(99, 102, 241, 0.2);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.08);
}

.psych-ai-interp-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.psych-ai-interp-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    flex-shrink: 0;
}

.psych-ai-interp-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.psych-ai-interp-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--psych-text);
    margin: 0;
}

.psych-ai-interp-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.psych-ai-interp-body {
    padding: 24px;
}

/* Loading Animation */
.psych-ai-interp-loading,
.psych-ai-interp-graphs-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px;
    text-align: center;
}

.psych-ai-interp-loading p,
.psych-ai-interp-graphs-loading p {
    margin: 0;
    color: var(--psych-text-muted);
    font-size: 0.9rem;
}

.psych-ai-loader {
    display: flex;
    gap: 6px;
}

.psych-ai-loader-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--psych-primary);
    animation: psych-ai-bounce 1.4s infinite ease-in-out both;
}

.psych-ai-loader-dot:nth-child(1) { animation-delay: -0.32s; }
.psych-ai-loader-dot:nth-child(2) { animation-delay: -0.16s; }
.psych-ai-loader-dot:nth-child(3) { animation-delay: 0s; }

@keyframes psych-ai-bounce {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---- Graphs Section ---- */
.psych-ai-interp-graphs {
    margin-bottom: 24px;
}

.psych-ai-graph-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .psych-ai-graph-row { grid-template-columns: 1fr; }
}

.psych-ai-graph-card {
    background: var(--psych-bg);
    border: 1px solid var(--psych-border);
    border-radius: 12px;
    padding: 18px;
}

.psych-ai-graph-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--psych-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.psych-ai-graph-sub {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--psych-text-light);
}

/* Percentile Gauge */
.psych-ai-percentile-card {
    text-align: center;
}

.psych-ai-percentile-gauge {
    margin: 8px 0;
}

.psych-ai-gauge-track {
    position: relative;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: visible;
}

.psych-ai-gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 6px;
    width: 0%;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.psych-ai-gauge-marker {
    position: absolute;
    top: -4px;
    left: 0%;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #6366f1;
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.psych-ai-gauge-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.65rem;
    color: var(--psych-text-light);
}

.psych-ai-percentile-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--psych-primary);
    margin-top: 8px;
}

.psych-ai-percentile-value sup {
    font-size: 0.5em;
    color: var(--psych-text-muted);
}

.psych-ai-percentile-desc {
    font-size: 0.82rem;
    color: var(--psych-text-muted);
    margin-top: 4px;
}

/* Score Position Bar */
.psych-ai-position-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.psych-ai-compare-bar-wrap {
    position: relative;
    margin: 16px 0 8px;
}

.psych-ai-compare-bar {
    position: relative;
    height: 10px;
    background: linear-gradient(90deg, #e2e8f0 0%, #c7d2fe 50%, #e2e8f0 100%);
    border-radius: 5px;
}

.psych-ai-compare-mean,
.psych-ai-compare-user {
    position: absolute;
    top: -28px;
    transform: translateX(-50%);
    text-align: center;
}

.psych-ai-compare-mean span,
.psych-ai-compare-user span {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.psych-ai-compare-mean {
    color: var(--psych-text-light);
}

.psych-ai-compare-mean::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 14px;
    background: var(--psych-text-light);
    border-radius: 1px;
}

.psych-ai-compare-user {
    color: var(--psych-primary);
}

.psych-ai-compare-user::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 14px;
    background: var(--psych-primary);
    border-radius: 2px;
}

.psych-ai-compare-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--psych-text-light);
    margin-top: 4px;
}

.psych-ai-diff {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
    width: 100%;
}

.psych-ai-diff.positive {
    background: #ecfdf5;
    color: #059669;
}

.psych-ai-diff.negative {
    background: #fef2f2;
    color: #dc2626;
}

.psych-ai-diff.neutral {
    background: #f8fafc;
    color: var(--psych-text-muted);
}

/* Histogram */
.psych-ai-histogram-card {
    grid-column: 1 / -1;
}

.psych-ai-histogram {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 100px;
    padding: 0 4px;
}

.psych-ai-hist-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.psych-ai-hist-bar {
    width: 100%;
    min-height: 2px;
    background: #c7d2fe;
    border-radius: 3px 3px 0 0;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.psych-ai-hist-bar.user-bar {
    background: linear-gradient(180deg, #6366f1, #a855f7);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.psych-ai-hist-you {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--psych-primary);
    white-space: nowrap;
    background: white;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--psych-primary);
}

.psych-ai-hist-label {
    font-size: 0.55rem;
    color: var(--psych-text-light);
    margin-top: 4px;
    text-align: center;
}

/* Mini Comparison Cards */
.psych-ai-mini-card {
    text-align: center;
}

.psych-ai-mini-compare {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.psych-ai-mini-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.psych-ai-mini-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--psych-text);
}

.psych-ai-mini-lbl {
    font-size: 0.7rem;
    color: var(--psych-text-light);
    text-transform: uppercase;
}

.psych-ai-mini-vs {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--psych-text-light);
    padding: 4px 8px;
    background: var(--psych-border);
    border-radius: 12px;
}

/* ---- AI Trigger Button Section ---- */
.psych-ai-trigger-section,
.psych-ai-guide-section {
    text-align: center;
    padding: 24px 0;
}

.psych-ai-trigger-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--psych-primary), transparent);
    margin: 0 auto 20px;
}

.psych-ai-trigger-text {
    font-size: 0.95rem;
    color: var(--psych-text-muted);
    margin: 0 0 16px;
}

.psych-ai-guide-text {
    font-size: 0.95rem;
    color: #065f46;
    margin: 0 0 16px;
    padding: 10px 16px;
    background: #ecfdf5;
    border-radius: 8px;
    border: 1px solid #a7f3d0;
    display: inline-block;
}

.psych-ai-trigger-btn {
    font-size: 1rem;
    padding: 14px 28px;
    border-radius: 12px;
    gap: 10px;
}

.psych-btn-guide {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    font-size: 1rem;
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: var(--psych-transition);
}

.psych-btn-guide:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.psych-ai-trigger-badge {
    display: block;
    margin-top: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--psych-text-light);
    letter-spacing: 0.3px;
}

/* ---- Guide Content ---- */
.psych-ai-guide-content {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
}

.psych-ai-guide-header-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #a7f3d0;
}

.psych-ai-guide-header-card h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #065f46;
}

.psych-ai-guide-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #d1fae5;
}

.psych-ai-guide-section-header:first-of-type {
    margin-top: 0;
}

.psych-ai-guide-section-header span {
    font-size: 1.1rem;
}

.psych-ai-guide-section-header h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #047857;
}

.psych-ai-guide-paragraph {
    margin: 0 0 10px;
    font-size: 0.92rem;
    line-height: 1.7;
    color: #1e293b;
}

.psych-ai-guide-paragraph:last-child {
    margin-bottom: 0;
}

/* ---- AI Content Sections ---- */
.psych-ai-interp-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--psych-text-secondary);
}

.psych-ai-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(99, 102, 241, 0.1);
}

.psych-ai-section-header:first-child {
    margin-top: 0;
}

.psych-ai-section-icon {
    font-size: 1.2rem;
}

.psych-ai-section-header h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--psych-text);
}

.psych-ai-paragraph {
    margin: 0 0 12px;
    color: var(--psych-text-secondary);
}

.psych-ai-paragraph:last-child {
    margin-bottom: 0;
}

/* Error */
.psych-ai-interp-error {
    text-align: center;
    padding: 16px;
}

.psych-ai-interp-error p {
    margin: 0;
    color: var(--psych-warning);
    font-size: 0.9rem;
}

/* Footer */
.psych-ai-interp-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px 16px;
    border-top: 1px solid var(--psych-border);
}

.psych-ai-interp-footer small {
    color: var(--psych-text-light);
    font-size: 0.72rem;
    font-style: italic;
}


/* ============================
   ARCHIVE SEARCH & SORT BAR
   ============================ */

.psych-archive-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto 24px;
    padding: 14px 20px;
    background: var(--psych-surface);
    border: 1px solid var(--psych-border);
    border-radius: var(--psych-radius-sm);
    box-shadow: var(--psych-shadow-sm);
    flex-wrap: wrap;
}

.psych-search-input-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.psych-search-input-wrap svg {
    position: absolute;
    left: 14px;
    pointer-events: none;
}

.psych-search-input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 2px solid var(--psych-border);
    border-radius: var(--psych-radius-full);
    font-size: 0.9rem;
    font-family: var(--psych-font);
    background: var(--psych-bg);
    color: var(--psych-text);
    transition: var(--psych-transition);
}

.psych-search-input::placeholder {
    color: var(--psych-text-light);
}

.psych-search-input:focus {
    outline: none;
    border-color: var(--psych-primary);
    background: var(--psych-surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.psych-sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.psych-sort-label {
    font-size: 0.82rem;
    color: var(--psych-text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.psych-sort-select {
    padding: 8px 12px;
    border: 2px solid var(--psych-border);
    border-radius: var(--psych-radius-sm);
    font-size: 0.85rem;
    font-family: var(--psych-font);
    background: var(--psych-bg);
    color: var(--psych-text);
    cursor: pointer;
    transition: var(--psych-transition);
}

.psych-sort-select:focus {
    outline: none;
    border-color: var(--psych-primary);
}

.psych-search-count {
    font-size: 0.78rem;
    color: var(--psych-text-light);
    font-weight: 500;
    white-space: nowrap;
}

/* Compact Card (no image) */
.psych-card-compact {
    padding-top: 0;
}

.psych-card-compact .psych-card-body {
    padding-top: 20px;
}

.psych-card-badge-inline {
    display: inline-block;
    margin: 16px 20px 0;
    padding: 3px 10px;
    background: var(--psych-primary-bg);
    color: var(--psych-primary);
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--psych-radius-full);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

@media (max-width: 600px) {
    .psych-archive-search-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .psych-sort-wrap {
        justify-content: space-between;
    }
}
