@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --purple-400: #a78bfa;
    --purple-500: #8b5cf6;
    --purple-600: #7c3aed;
    --purple-700: #6d28d9;
    --purple-900: #4c1d95;
    --green-400: #34d399;
    --green-500: #10b981;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 0 8px rgba(139, 92, 246, 0.3); } 50% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.6); } }
@keyframes progress-stripe { 0% { background-position: 1rem 0; } 100% { background-position: 0 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fade-in 0.4s ease-out; }
.animate-fade-up { animation: fade-up 0.5s ease-out; }
.pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }

.progress-bar-animated {
    background-image: linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.1) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
    animation: progress-stripe 0.5s linear infinite;
}

.spinner-ring {
    width: 28px; height: 28px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner { width: 40px; height: 40px; border: 4px solid rgba(139, 92, 246, 0.3); border-top: 4px solid #8b5cf6; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }

.spinner-sm {
    width: 14px; height: 14px;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

textarea:focus, select:focus, input:focus { outline: none; }

.help-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: rgba(139, 92, 246, 0.15); color: #a78bfa;
    font-size: 11px; font-weight: 700; cursor: help;
    transition: all 0.2s; flex-shrink: 0;
}
.help-icon:hover { background: rgba(139, 92, 246, 0.35); transform: scale(1.1); }

.niche-details { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.niche-details.expanded { max-height: 3000px; transition: max-height 0.5s ease-in; }

.wizard-step { transition: all 0.3s ease; }
.wizard-step.active .step-circle { background: #7c3aed; color: #fff; box-shadow: 0 0 16px rgba(124, 58, 237, 0.5); }
.wizard-step.completed .step-circle { background: #10b981; color: #fff; }
.wizard-step .step-circle { background: #374151; color: #6b7280; transition: all 0.3s; }
.wizard-connector { height: 2px; flex: 1; background: #374151; transition: background 0.5s; min-width: 16px; }
.wizard-connector.active { background: linear-gradient(90deg, #10b981, #7c3aed); }
.wizard-connector.completed { background: #10b981; }

.badge-inventory { background: #7c2d12; color: #fb923c; }
.badge-no-inventory { background: #064e3b; color: #34d399; }

.pipeline-step { opacity: 0.35; transition: all 0.4s; }
.pipeline-step.active { opacity: 1; transform: scale(1.05); }
.pipeline-step.done { opacity: 1; }
.pipeline-arrow { color: #4b5563; transition: color 0.3s; }
.pipeline-arrow.active { color: #8b5cf6; }

.card-hover { transition: all 0.2s ease; }
.card-hover:hover { border-color: rgba(139, 92, 246, 0.4); box-shadow: 0 4px 24px rgba(0,0,0,0.3); }

.domain-card { transition: border-color 0.2s; }
.domain-card:hover { border-color: #6d28d9; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.generate-pkg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-content {
    background: #1f2937; border: 1px solid #374151;
    border-radius: 20px; max-width: 680px; width: 100%;
    max-height: 85vh; overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    transform: translateY(20px); transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content { transform: translateY(0); }

.discovery-step { display: none; animation: fade-in 0.3s ease-out; }
.discovery-step.active { display: block; }

.discovery-progress {
    display: flex; gap: 6px; padding: 0 32px;
}
.discovery-progress-dot {
    height: 4px; flex: 1; border-radius: 4px;
    background: #374151; transition: background 0.3s;
}
.discovery-progress-dot.active { background: #8b5cf6; }
.discovery-progress-dot.completed { background: #10b981; }

.discovery-input {
    width: 100%; background: #111827; border: 1px solid #374151;
    border-radius: 12px; padding: 14px 18px; color: #f3f4f6;
    font-size: 0.95rem; line-height: 1.6; transition: border-color 0.2s;
    font-family: inherit; resize: vertical;
}
.discovery-input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15); }
.discovery-input::placeholder { color: #6b7280; }

.template-card {
    background: #111827; border: 2px solid #374151;
    border-radius: 16px; padding: 20px; cursor: pointer;
    transition: all 0.2s; text-align: center;
}
.template-card:hover { border-color: #6d28d9; background: #1a1f2e; }
.template-card.selected { border-color: #8b5cf6; background: #1e1b4b; box-shadow: 0 0 20px rgba(139, 92, 246, 0.2); }

.tag-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 500;
    background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.2);
    cursor: pointer; transition: all 0.2s; user-select: none;
}
.tag-pill:hover { background: rgba(139, 92, 246, 0.25); }
.tag-pill.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }

.toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    background: #1f2937; border: 1px solid #374151; border-radius: 12px;
    padding: 16px 24px; color: #f3f4f6; font-size: 0.9rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: slide-up 0.3s ease-out;
    display: flex; align-items: center; gap: 12px;
}
.toast.success { border-color: #10b981; }
.toast.error { border-color: #ef4444; }

.shimmer {
    background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
    border: 1px solid #374151; background: transparent;
    color: #9ca3af; transition: all 0.2s; flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border-color: #6d28d9; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

.sticky-header { position: sticky; top: 0; z-index: 50; }
.sticky-wizard { position: sticky; top: 49px; z-index: 40; padding-top: 8px; padding-bottom: 8px; }
.sticky-tabs { position: sticky; top: 49px; z-index: 40; padding-top: 8px; padding-bottom: 4px; }

[data-theme="light"] .sticky-wizard,
[data-theme="light"] .sticky-tabs {
    background: #f3f4f6;
    border-bottom: 1px solid #d1d5db;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
[data-theme="light"] .sticky-header {
    border-bottom-color: #c4c8cf !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}
[data-theme="dark"] .sticky-wizard,
[data-theme="dark"] .sticky-tabs { background: #111827; }

[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

[data-theme="light"] body,
[data-theme="light"] .bg-gray-900 { background-color: #f3f4f6 !important; }
[data-theme="light"] .bg-gray-800 { background-color: #ffffff !important; }
[data-theme="light"] .bg-gray-700 { background-color: #e5e7eb !important; }
[data-theme="light"] .bg-gray-900.rounded-xl,
[data-theme="light"] .domain-card.bg-gray-900,
[data-theme="light"] .section-card,
[data-theme="light"] .editable-field { background-color: #ffffff !important; }

[data-theme="light"] .text-gray-100,
[data-theme="light"] .text-white { color: #111827 !important; }
[data-theme="light"] .text-gray-200 { color: #1f2937 !important; }
[data-theme="light"] .text-gray-300 { color: #374151 !important; }
[data-theme="light"] .text-gray-400 { color: #6b7280 !important; }
[data-theme="light"] .text-gray-500 { color: #9ca3af !important; }
[data-theme="light"] .text-gray-600 { color: #6b7280 !important; }

[data-theme="light"] .border-gray-700,
[data-theme="light"] .border-purple-800,
[data-theme="light"] .border-gray-800 { border-color: #d1d5db !important; }
[data-theme="light"] .border-gray-600 { border-color: #c4c8cf !important; }

[data-theme="light"] .bg-gray-800.rounded-xl {
    border-color: #94a3b8 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04) !important;
}
[data-theme="light"] .bg-gray-800.rounded-lg {
    border-color: #94a3b8 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
}

[data-theme="light"] textarea,
[data-theme="light"] select,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="color"] {
    background-color: #ffffff !important;
    border: 1px solid #c4c8cf !important;
    color: #111827 !important;
}
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus,
[data-theme="light"] input[type="text"]:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15) !important;
}
[data-theme="light"] textarea::placeholder,
[data-theme="light"] input::placeholder { color: #9ca3af !important; }

[data-theme="light"] .modal-content {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15) !important;
}
[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.4) !important;
}

[data-theme="light"] .discovery-input {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
    color: #111827 !important;
}
[data-theme="light"] .discovery-progress-dot { background: #d1d5db !important; }
[data-theme="light"] .discovery-progress-dot.active { background: #8b5cf6 !important; }
[data-theme="light"] .discovery-progress-dot.completed { background: #10b981 !important; }

[data-theme="light"] .template-card {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
}
[data-theme="light"] .template-card:hover { background: #eef2ff !important; border-color: #6d28d9 !important; }
[data-theme="light"] .template-card.selected { background: #ede9fe !important; border-color: #8b5cf6 !important; }

[data-theme="light"] .wizard-step .step-circle { background: #e5e7eb !important; color: #6b7280 !important; }
[data-theme="light"] .wizard-step.active .step-circle { background: #7c3aed !important; color: #fff !important; }
[data-theme="light"] .wizard-step.completed .step-circle { background: #10b981 !important; color: #fff !important; }
[data-theme="light"] .wizard-connector { background: #d1d5db !important; }
[data-theme="light"] .wizard-connector.active { background: linear-gradient(90deg, #10b981, #7c3aed) !important; }
[data-theme="light"] .wizard-connector.completed { background: #10b981 !important; }

[data-theme="light"] .pipeline-step .bg-gray-800 { background: #f3f4f6 !important; }

[data-theme="light"] .toast {
    background: #ffffff !important;
    border-color: #d1d5db !important;
    color: #111827 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1) !important;
}

[data-theme="light"] .card-hover:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
    border-color: #a5b4c8 !important;
}

[data-theme="light"] .bg-gray-700.rounded-lg,
[data-theme="light"] .bg-gray-700.rounded-xl {
    border: 1px solid #d1d5db !important;
}

[data-theme="light"] .bg-gray-700.hover\:bg-gray-600:hover {
    background: #d1d5db !important;
}

[data-theme="light"] .shimmer {
    background: linear-gradient(90deg, #e5e7eb 25%, #d1d5db 50%, #e5e7eb 75%) !important;
}

[data-theme="light"] .help-icon { background: rgba(139, 92, 246, 0.1) !important; }

[data-theme="light"] .theme-toggle { border-color: #d1d5db; color: #6b7280; }

[data-theme="light"] .tab-btn:not(.active) { background: #f9fafb !important; color: #6b7280 !important; border-color: #d1d5db !important; }
[data-theme="light"] .tab-btn:not(.active):hover { background: #e5e7eb !important; color: #374151 !important; }

[data-theme="light"] .editable-field { background: #f9fafb !important; border-color: #d1d5db !important; color: #111827 !important; }
[data-theme="light"] .chat-msg.ai { background: #f3f4f6 !important; color: #374151 !important; border-color: #e5e7eb !important; }
[data-theme="light"] .revision-item { border-color: #e5e7eb !important; }
[data-theme="light"] .color-swatch { border-color: #d1d5db !important; }
[data-theme="light"] .asset-card { background: #ffffff !important; border-color: #e5e7eb !important; }

[data-theme="light"] .badge-inventory { background: #fef3c7 !important; color: #92400e !important; }
[data-theme="light"] .badge-no-inventory { background: #d1fae5 !important; color: #065f46 !important; }

[data-theme="light"] select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
}

.prose-inline p { margin: 0; display: inline; }
.prose-inline p + p { display: block; margin-top: 4px; }

.prose-rendered p { margin-bottom: 0.6em; }
.prose-rendered p:last-child { margin-bottom: 0; }
.prose-rendered strong { font-weight: 700; color: inherit; }
.prose-rendered em { font-style: italic; }
.prose-rendered ul, .prose-rendered ol { padding-left: 1.4em; margin-bottom: 0.6em; }
.prose-rendered li { margin-bottom: 0.25em; }
.prose-rendered a { color: #8b5cf6; text-decoration: underline; }
.prose-rendered h1, .prose-rendered h2, .prose-rendered h3, .prose-rendered h4 {
    font-weight: 700; margin-top: 0.8em; margin-bottom: 0.4em;
}
.prose-rendered h1 { font-size: 1.3em; }
.prose-rendered h2 { font-size: 1.15em; }
.prose-rendered h3 { font-size: 1.05em; }
.prose-rendered code {
    background: rgba(139, 92, 246, 0.15);
    padding: 1px 5px; border-radius: 4px;
    font-size: 0.88em; font-family: 'SF Mono', 'Fira Code', monospace;
}
.prose-rendered blockquote {
    border-left: 3px solid #8b5cf6;
    padding-left: 12px;
    margin: 0.6em 0;
    opacity: 0.85;
    font-style: italic;
}
.prose-rendered hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 0.8em 0; }

.chat-msg.ai .prose-rendered { font-size: 0.8rem; line-height: 1.6; }
.chat-msg.ai .prose-rendered p { margin-bottom: 0.4em; }
.chat-msg.ai .prose-rendered ul, .chat-msg.ai .prose-rendered ol { padding-left: 1.2em; margin-bottom: 0.3em; }
.chat-msg.ai .prose-rendered li { margin-bottom: 0.15em; }

.bp-section-card { transition: all 0.2s ease; }
.bp-section-card:hover { border-color: rgba(139, 92, 246, 0.3); }
.bp-depth-btn { cursor: pointer; }
.bp-depth-btn:hover { border-color: rgba(139, 92, 246, 0.5) !important; }
#bp-sections-container::-webkit-scrollbar { width: 6px; }
#bp-sections-container::-webkit-scrollbar-track { background: transparent; }
#bp-sections-container::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 3px; }
#bp-sections-container::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.5); }

.scrollbar-thin::-webkit-scrollbar { width: 5px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(107, 114, 128, 0.4); border-radius: 3px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: rgba(107, 114, 128, 0.6); }

.jq-filter-btn.active { background: rgb(126, 34, 206); color: white; }

.pf-metric-card {
    background: linear-gradient(160deg, rgba(17,24,39,0.95), rgba(30,27,50,0.9));
    border: 1px solid rgba(107,114,128,0.2);
    border-radius: 12px;
    padding: 10px 12px;
    transition: all 0.2s;
}
.pf-metric-card:hover {
    border-color: rgba(139,92,246,0.3);
    box-shadow: 0 4px 12px rgba(139,92,246,0.08);
}
.pf-metric-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9CA3AF;
    margin-bottom: 2px;
}
.pf-metric-value {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.pf-metric-sub {
    font-size: 10px;
    color: #6B7280;
    margin-top: 1px;
}

.pf-content-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid;
    transition: all 0.2s;
    flex-shrink: 0;
}
.pf-content-icon:hover {
    transform: scale(1.15);
    filter: brightness(1.3);
}

.pf-decision-badge {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border-radius: 6px;
    ring-width: 1px;
    ring-offset-width: 0px;
    box-shadow: inset 0 0 0 1px currentColor;
    opacity: 0.9;
}
