/* GHL AI Assistant — Aesthetic Theme */

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

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

:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --primary-dark: #5a4bd1;
    --accent: #00cec9;
    --accent-light: #81ecec;
    --success: #00b894;
    --success-light: #55efc4;
    --warning: #fdcb6e;
    --danger: #ff7675;
    --danger-dark: #d63031;
    --dark: #2d3436;
    --dark-soft: #636e72;
    --gray: #b2bec3;
    --gray-light: #dfe6e9;
    --bg: #f8f9fd;
    --card-bg: #ffffff;
    --text: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;
    --shadow-sm: 0 2px 8px rgba(108,92,231,0.06);
    --shadow-md: 0 4px 20px rgba(108,92,231,0.1);
    --shadow-lg: 0 8px 40px rgba(108,92,231,0.12);
    --shadow-hover: 0 8px 30px rgba(108,92,231,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
    background: linear-gradient(135deg, #2d3436 0%, #1e272e 50%, #2d3436 100%);
    color: white;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.header h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}
.header-link {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}
.header-link:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.08);
}
.header-link-active {
    color: white;
    background: var(--primary);
    box-shadow: 0 2px 12px rgba(108,92,231,0.4);
}

/* ── Container ── */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 20px;
}

/* ── Cards ── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(108,92,231,0.06);
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
}
a.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(108,92,231,0.15);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: -0.2px;
    gap: 6px;
}
.btn-approve {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108,92,231,0.3);
}
.btn-approve:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108,92,231,0.4);
}
.btn-reject {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255,118,117,0.3);
}
.btn-reject:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255,118,117,0.4);
}
.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--gray-light);
}
.btn-secondary:hover {
    background: var(--gray-light);
    border-color: var(--gray);
}
.btn-small { padding: 6px 14px; font-size: 12px; border-radius: 6px; }

/* ── Badges ── */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-pending {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}
.badge-approve {
    background: linear-gradient(135deg, #d4edda 0%, #55efc4 30%, #d4edda 100%);
    color: #155724;
}
.badge-reject { background: #ffeef0; color: #d63031; }
.badge-info { background: #e8f4fd; color: #2980b9; }

.badge-urgency { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-low { background: #d4edda; color: #155724; }
.badge-medium { background: #fff3cd; color: #856404; }
.badge-high { background: #ffeef0; color: #d63031; }

/* ── Info Rows ── */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 600; color: var(--text-secondary); flex-shrink: 0; margin-right: 16px; }
.info-value { color: var(--text); text-align: right; }

/* ── Text Areas ── */
.draft-area {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: var(--transition);
    background: var(--bg);
    line-height: 1.6;
}
.draft-area:focus {
    border-color: var(--primary-light);
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}

/* ── Score Bar ── */
.score-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-light);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.score-fill { height: 100%; border-radius: 3px; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }

/* ── Login ── */
.login-container {
    max-width: 380px;
    margin: 100px auto;
    padding: 20px;
}
.login-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-md);
    font-size: 20px;
    text-align: center;
    letter-spacing: 10px;
    font-family: inherit;
    margin-bottom: 16px;
    transition: var(--transition);
    background: var(--bg);
}
.login-input:focus {
    border-color: var(--primary-light);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}
.error-message { color: var(--danger-dark); text-align: center; margin-bottom: 12px; font-size: 14px; }

/* ── Tabs ── */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-light);
}
.tab-btn {
    padding: 12px 22px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Forms ── */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-select {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: var(--transition);
    color: var(--text);
}
.form-select:focus {
    border-color: var(--primary-light);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}
.form-row { display: flex; gap: 16px; }
.form-col { flex: 1; }

/* ── Variables Reference ── */
.variables-ref {
    margin-top: 20px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--bg);
}
.variables-ref summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}
.variables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 14px;
}
.var-group h4 { font-size: 13px; color: var(--primary); margin-bottom: 8px; font-weight: 700; }
.var-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
    transition: var(--transition);
}
.var-item:hover { background: rgba(108,92,231,0.06); }
.var-item code {
    font-size: 11px;
    background: rgba(108,92,231,0.08);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--primary);
    font-weight: 500;
}
.var-item span { color: var(--text-secondary); margin-left: 10px; }

/* ── Prompt Output ── */
.prompt-output {
    background: linear-gradient(135deg, #2d3436 0%, #1e272e 100%);
    color: #dfe6e9;
    padding: 22px;
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 12px 0;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.05);
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}
.stat-card {
    background: linear-gradient(135deg, var(--bg) 0%, #f0efff 100%);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
    border: 1px solid rgba(108,92,231,0.08);
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.stat-number {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ── Lead List ── */
.lead-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    gap: 12px;
}
.lead-item:last-child { border-bottom: none; }
.lead-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Template Grid ── */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.template-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 18px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-md);
    transition: var(--transition);
    background: white;
}
.template-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.template-card h4 { font-size: 14px; margin-bottom: 6px; font-weight: 600; }
.template-card p { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }
.template-meta { display: flex; gap: 8px; align-items: center; }

/* ── Alerts ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-success { background: #f0fff4; color: #155724; border-color: rgba(0,184,148,0.2); }
.alert-warning { background: #fffdf0; color: #856404; border-color: rgba(253,203,110,0.3); }
.alert-info { background: #f0f4ff; color: #2d3436; border-color: rgba(108,92,231,0.15); }

/* ── Chat / Workflow Builder ── */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: linear-gradient(180deg, #f8f9fd 0%, #f0efff 100%);
}
.chat-message {
    display: flex;
    max-width: 82%;
    animation: chatFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-user {
    align-self: flex-end;
    justify-content: flex-end;
}
.chat-assistant {
    align-self: flex-start;
}
.chat-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}
.chat-bubble-user {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(108,92,231,0.25);
}
.chat-bubble-assistant {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid rgba(108,92,231,0.1);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(108,92,231,0.08);
    background: white;
}
.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    background: var(--bg);
}
.chat-input:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}
.chat-typing {
    color: var(--primary-light);
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.chat-prompt-result {
    background: white;
    border: 1px solid rgba(108,92,231,0.12);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 95%;
    box-shadow: var(--shadow-md);
}
.chat-prompt-result .prompt-output {
    font-size: 12px;
}
.chat-prompt-result .info-row {
    margin-top: 8px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dark-soft); }

/* ── Selection ── */
::selection {
    background: rgba(108,92,231,0.2);
    color: var(--text);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .form-row { flex-direction: column; gap: 0; }
    .header { padding: 0 12px; height: auto; padding: 12px; }
    .header-nav { gap: 2px; }
    .header-link { font-size: 11px; padding: 6px 8px; }
    .container { padding: 16px 12px; }
    .variables-grid { grid-template-columns: 1fr; }
    .template-grid { grid-template-columns: 1fr; }
    .lead-item { flex-direction: column; align-items: flex-start; }
    .lead-actions { margin-top: 8px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .chat-container { height: 300px !important; }
    .chat-message { max-width: 92%; }
}
