:root {
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-info: #3b82f6;
    --glass-blur: blur(12px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Gradients */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, transparent 70%);
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    z-index: -1;
}

.app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
}

/* Sidebar / Lead List */
.sidebar {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, #a78bfa, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lead-list {
    flex: 1;
    overflow-y: auto;
}

.lead-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lead-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lead-item.active {
    background: rgba(124, 58, 237, 0.15);
    border-left: 4px solid var(--primary-color);
}

.lead-info-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.lead-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.lead-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

.status-new { color: #60a5fa; background: rgba(96, 165, 250, 0.1) !important; }
.status-contacted { color: #f59e0b; background: rgba(245, 158, 11, 0.1) !important; }
.status-closed { color: #10b981; background: rgba(16, 185, 129, 0.1) !important; }

.lead-last-msg {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Chat Area */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

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

.chat-user-info h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.chat-user-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-image: radial-gradient(rgba(255,255,255,0.02) 1px, transparent 0);
    background-size: 24px 24px;
}

.message {
    max-width: 70%;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.message.inbound {
    align-self: flex-start;
    background: #1e293b;
    border-bottom-left-radius: 2px;
}

.message.outbound {
    align-self: flex-end;
    background: var(--primary-color);
    border-bottom-right-radius: 2px;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.5rem;
    display: block;
    text-align: right;
}

.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.75rem;
    resize: none;
    height: 50px;
    outline: none;
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: var(--primary-hover);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Lead Details View */
.lead-detail-header {
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.lead-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.lead-main-info h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.lead-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lead-meta i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.tabs-container {
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 2rem;
}

.tab {
    padding: 1rem 0;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
}

.tab.active {
    color: var(--text-main);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    padding: 2rem;
    flex: 1;
    overflow: hidden;
}

.scroll-area {
    overflow-y: auto;
    padding-right: 1rem;
}

/* Activity Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.35rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-dark);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timeline-content {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* Quick Actions Card */
.actions-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.card h3 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field-group {
    margin-bottom: 1rem;
}

.field-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.field-value {
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

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

/* Notes Section */
.note-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 100px;
    resize: none;
}
