/* Customer Profiler – modern UI */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #0f0f12;
    --bg-elevated: #18181c;
    --bg-card: #1c1c22;
    --border: #2a2a32;
    --text: #e4e4e7;
    --text-muted: #a1a1aa;
    --accent: #a78bfa;
    --accent-dim: #7c3aed;
    --success: #34d399;
    --warn: #fbbf24;
    --error: #f87171;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.35);
    --font: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 40px;
}
@media (min-width: 768px) {
    .app-wrap { padding: 0 28px 48px; }
}

/* Nav */
.nav {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    margin-bottom: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.nav .brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    margin-right: 8px;
}
.nav .brand:hover { color: var(--accent); }
.nav a:not(.brand) {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.nav a:not(.brand):hover {
    color: var(--text);
    background: var(--bg-card);
}
.nav a.active { color: var(--accent); }

.tidbit-quote {
    max-width: 1100px;
    margin: 0 auto 16px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
    border-left: 3px solid var(--accent);
    background: var(--bg-elevated);
}

/* Page title */
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 8px;
    color: var(--text);
}
.lead {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0 0 28px;
    max-width: 560px;
}
.types-search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    margin-bottom: 16px;
}
.types-search-input::placeholder { color: var(--text-muted); }
.types-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Type cards grid */
.types-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 480px) {
    .types-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
    .types-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}
.type-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.15s;
    display: block;
}
.type-card:hover {
    border-color: var(--accent-dim);
    transform: translateY(-2px);
}
.type-card-main {
    display: block;
    text-decoration: none;
    color: inherit;
}
.type-card-roleplay {
    display: block;
    padding: 8px 16px;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    color: var(--accent);
    text-decoration: none;
}
.type-card-roleplay:hover {
    background: var(--bg-elevated);
}
.type-card-img-wrap {
    aspect-ratio: 1;
    background: var(--bg-elevated);
    overflow: hidden;
}
.type-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.type-card-body {
    padding: 16px;
}
.type-card-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
    color: var(--text);
}
.type-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 6px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 20px;
    transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

/* Type detail */
.type-hero {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}
@media (min-width: 640px) {
    .type-hero { grid-template-columns: 200px 1fr; align-items: start; }
}
.type-hero-img-wrap {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}
.type-hero-img { width: 100%; height: 100%; object-fit: cover; }
.type-hero-text h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}
.type-hero-desc {
    color: var(--text-muted);
    margin: 0;
    font-size: 1rem;
}

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.section-card h2 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 12px;
}
.section-card p, .section-card ul {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
}
.approaches {
    list-style: none;
    padding: 0;
    margin: 0;
}
.approaches li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.approaches li:last-child { border-bottom: none; }
.approaches .approach-title {
    font-weight: 600;
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
}
.approaches .approach-desc {
    color: var(--text-muted);
    display: block;
    font-size: 0.85rem;
}

/* Chat widget */
.type-chat, .chat-page-wrap {
    margin-top: 28px;
}
.chat-messages, #type-chat-messages {
    min-height: 160px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.chat-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    max-width: 90%;
}
.chat-msg.user {
    background: var(--accent-dim);
    color: #fff;
    margin-left: auto;
}
.chat-msg.bot {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    white-space: pre-wrap;
}
.chat-msg.error { color: var(--error); }
.chat-form, .type-chat form {
    display: flex;
    gap: 10px;
    margin-top: 0;
}
.chat-form input, #type-chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
}
.chat-form input::placeholder, #type-chat-input::placeholder {
    color: var(--text-muted);
}
.chat-form input:focus, #type-chat-input:focus {
    outline: none;
    border-color: var(--accent);
}
.chat-form button, #type-chat-form button {
    padding: 12px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s;
}
.chat-form button:hover, #type-chat-form button:hover {
    background: var(--accent-dim);
}

/* Image profiler */
.profiler-upload {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
    transition: border-color 0.2s;
}
.profiler-upload:hover, .profiler-upload.dragover { border-color: var(--accent); }
.profiler-upload input[type="file"] {
    margin: 0 auto 12px;
    display: block;
    color: var(--text-muted);
}
.profiler-upload .analyze-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    font-size: 0.95rem;
}
.profiler-upload .analyze-btn:hover { background: var(--accent-dim); }
.profiler-upload .analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.training-section {
    margin-bottom: 28px;
}
.training-section h2 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 12px;
}
.training-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.training-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
    opacity: 0.9;
}
.training-thumb:hover { opacity: 1; }

.image-result {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.image-result h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text);
}
.image-result ul {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}
.image-result li {
    padding: 10px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.image-result li strong { color: var(--accent); }
.loading-quote { font-style: italic; color: var(--text-muted); }
.chat-msg.loading-msg { opacity: 0.9; }

.image-result .best-target {
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-dim) 0%, var(--accent) 100%);
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 500;
}

/* Pitches page */
.text-muted { color: var(--text-muted); font-size: 0.9rem; }
.btn-primary {
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dim); }
.btn-delete {
    padding: 4px 10px;
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 8px;
}
.btn-delete:hover { background: var(--error); color: #fff; }
.btn-edit {
    padding: 4px 10px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 4px;
}
.btn-edit:hover { background: var(--accent); color: #fff; }
.btn-cancel-edit {
    padding: 8px 14px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: 8px;
}
.btn-cancel-edit:hover { color: var(--text); }
.pitches-ul { list-style: none; padding: 0; margin: 0; }
.pitch-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.pitch-row .type-slugs { color: var(--text-muted); font-size: 0.85rem; }
.analyze-result, .prune-result {
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.analyze-result ul, .prune-result ul { margin: 8px 0; padding-left: 20px; }
.analyze-result button, .prune-result button { margin-right: 8px; margin-top: 8px; }
.analyze-type-selector, #analyze-type-selector { display: block; }
.analyze-type-cb { display: inline-block; margin-right: 12px; margin-bottom: 6px; font-size: 0.85rem; }
.analyze-type-cb input { margin-right: 4px; }
.section-card label { display: block; margin-bottom: 4px; }
.section-card input[type="text"], .section-card textarea {
    width: 100%;
    max-width: 480px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
}
.section-card textarea { min-height: 60px; resize: vertical; }
.section-card p { margin: 0 0 12px; }
