/* ==========================================================================
   handlit — Lead Engine Demo Dashboard Styles
   Rich Aesthetics: Dark Mode, Glassmorphism, Vibrant Gradients, Micro-animations
   ========================================================================== */

:root {
  /* --- Dark-First Canvas & Surfaces --- */
  --bg-primary: #18171A;
  --bg-secondary: #201F22;
  --bg-card: #201F22;
  --bg-card-hover: #2A292D;
  --border-color: #333236;
  
  --text-primary: #F0EDE7;
  --text-secondary: #A9A6A1;
  --text-muted: #A9A6A1;
  
  --accent-cyan: #4ECDC4;
  --accent-blue: #38BDF8;
  --accent-purple: #4ECDC4;
  --accent-green: #10B981;
  --accent-orange: #F59E0B;
  --accent-red: #E07A61;
  
  --border-glow: rgba(78, 205, 196, 0.3);
  
  --font-heading: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.045;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Ghost Word Signature (MANDATORY RULE)
   Exactly one ghost-italic word per headline, wrapped in .ghost class,
   which must always be bold italic (weight: bold/700, style: italic).
   ========================================================================== */
.ghost {
    font-weight: 700 !important;
    font-style: italic !important;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    padding-right: 2px;
}

/* ==========================================================================
   Background & Glow Effects
   ========================================================================== */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.drafting-lines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.drafting-lines span {
    position: absolute;
    left: 0; right: 0;
    height: 1px;
    background: var(--border-color);
    opacity: 0.35;
}
.drafting-lines span:nth-child(1) { top: 20%; }
.drafting-lines span:nth-child(2) { top: 40%; }
.drafting-lines span:nth-child(3) { top: 60%; }
.drafting-lines span:nth-child(4) { top: 80%; }
.drafting-lines span:nth-child(5) { top: 96%; }

/* ==========================================================================
   Navigation Header
   ========================================================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 3rem;
    background: rgba(18, 21, 32, 0.6);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    letter-spacing: 0.3px;
}

.status-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pulse {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   Main Layout & Cards
   ========================================================================== */
.dashboard-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero-section h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.hero-subtext {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 2rem;
    align-items: start;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
}

.badge-sm {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ==========================================================================
   Forms & Controls
   ========================================================================== */
.config-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    background: rgba(9, 10, 15, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

.source-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.source-option {
    background: rgba(9, 10, 15, 0.6);
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.4rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.source-option input {
    display: none;
}

.source-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.source-option.active {
    background: rgba(0, 242, 254, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 600;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn {
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #090a0f;
    flex: 1;
    font-weight: 700;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 242, 254, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.btn-outline:hover:not(:disabled) {
    background: rgba(79, 172, 254, 0.15);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: #fff;
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(155, 81, 224, 0.4);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Metrics Display
   ========================================================================== */
.engine-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.metric-box {
    background: rgba(9, 10, 15, 0.5);
    border: 1px solid var(--border-color);
    padding: 1rem 0.5rem;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Status Bar & Table Feed
   ========================================================================== */
.status-bar {
    background: rgba(9, 10, 15, 0.6);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.status-bar.running {
    border-color: var(--accent-blue);
    background: rgba(79, 172, 254, 0.1);
    color: var(--text-primary);
}

.status-bar.completed {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.table-responsive {
    overflow-x: auto;
    max-height: 520px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.leads-table th {
    background: rgba(18, 21, 32, 0.95);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.leads-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.leads-table tr:hover:not(.empty-row) {
    background: rgba(255, 255, 255, 0.03);
}

.empty-row td {
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

/* Score Badges */
.score-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-block;
}

.score-high {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.score-mid {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-orange);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.score-low {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.lead-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.lead-title {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.icebreaker-box {
    background: rgba(9, 10, 15, 0.6);
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent-cyan);
    font-size: 0.82rem;
    color: #e2e8f0;
    line-height: 1.4;
    max-width: 320px;
}

.status-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-qualified {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.status-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* ==========================================================================
   Workflow Hint & Footer
   ========================================================================== */
.workflow-hint {
    margin-top: 1.5rem;
    background: rgba(79, 172, 254, 0.08);
    border: 1px solid rgba(79, 172, 254, 0.2);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.hint-icon {
    font-size: 1.2rem;
}

.workflow-hint code {
    background: rgba(0, 0, 0, 0.4);
    color: var(--accent-cyan);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.footer {
    margin-top: 4rem;
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.canonical-path code {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* ==========================================================================
   Responsive & Animations
   ========================================================================== */
@media (max-width: 1024px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
}

@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.new-lead-row {
    animation: fadeInRow 0.4s ease forwards;
}
