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

:root {
    --bg-primary: #0B1020;
    --bg-secondary: #111827;
    --glass-bg: rgba(17, 24, 39, 0.6);
    --glass-border: #1F2937;
    --glass-focus: rgba(124, 58, 237, 0.15);
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --accent-indigo: #7C3AED;
    --accent-indigo-hover: #8B5CF6;
    --accent-green: #10B981;
    --accent-yellow: #F59E0B;
    --accent-red: #EF4444;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

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

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-left: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-indigo), #ec4899);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.logo-text {
    font-weight: 700;
    font-size: 1.15rem;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(124, 58, 237, 0.15) !important;
    color: var(--text-primary) !important;
    border-left: 3px solid var(--accent-indigo);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

/* Connection Status Badge in Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
    margin-top: auto;
}

.conn-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-red);
}

.status-dot.connected {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

/* Top Header */
.top-header {
    height: 70px;
    border-bottom: 1px solid var(--glass-border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
    position: sticky;
    top: 0;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Board (Kanban View) */
.board-container {
    flex-grow: 1;
    padding: 24px;
    overflow-x: auto;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.board-column {
    width: 320px;
    max-height: 100%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 16px;
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.column-title-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

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

.card-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 10px;
}

.column-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 200px;
}

/* Card Styling */
.lead-card {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 14px;
    cursor: grab;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.3);
}

.lead-card:active {
    cursor: grabbing;
}

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

.card-author {
    font-weight: 600;
    font-size: 0.85rem;
}

.card-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-snippet {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-red {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    width: 1000px;
    max-width: 95vw;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-body {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Split view in details modal */
.modal-sidebar {
    width: 400px;
    border-right: 1px solid var(--glass-border);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Lead Info Details */
.info-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.info-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: var(--border-radius-md);
    white-space: pre-wrap;
    word-break: break-word;
}

.lead-notes-area {
    width: 100%;
    height: 100px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 10px;
    resize: none;
    font-family: inherit;
    font-size: 0.85rem;
}

.lead-notes-area:focus {
    outline: none;
    border-color: var(--accent-indigo);
    background: var(--glass-focus);
}

/* Chat Component */
.chat-messages {
    flex-grow: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
}

.chat-bubble.me {
    background-color: var(--accent-indigo);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-bubble.user {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-bubble-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    text-align: right;
}

.chat-bubble.user .chat-bubble-time {
    color: var(--text-muted);
}

.chat-input-container {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 12px;
}

.chat-input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 0.9rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-indigo);
}

/* Generic inputs and buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background-color: var(--accent-indigo);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-indigo-hover);
}

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

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

.btn-danger {
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.3);
}

/* Content Views */
.view-container {
    padding: 32px;
    display: none !important;
    flex-direction: column;
    gap: 24px;
    transition: background-color 0.3s ease;
}

.view-container.active {
    display: flex !important;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.view-title {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Settings/Group management lists */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

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

.item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

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

.item-actions {
    display: flex;
    gap: 8px;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 12px;
    font-size: 0.9rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-indigo);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--glass-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-green);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Switch in list items */
.switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Premium groups row matching screenshot */
.group-item-row {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
    gap: 16px;
}

.group-item-row:hover {
    border-color: rgba(124, 58, 237, 0.25);
    background-color: rgba(255, 255, 255, 0.01);
}

.group-col-main {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 2;
    min-width: 200px;
}

.group-col-members {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-width: 120px;
}

.group-col-status {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.group-col-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* AI Slider Styles */
.ai-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7C3AED;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.5);
    transition: all 0.2s ease;
}

.ai-slider::-webkit-slider-thumb:hover {
    background: #8B5CF6;
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.7);
}

.ai-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7C3AED;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.5);
}

/* Testing panel response box */
#automation-test-response {
    transition: background 0.3s ease;
}

#automation-test-response.loading {
    background: rgba(124, 58, 237, 0.05);
    border-color: rgba(124, 58, 237, 0.2);
}

/* ===== Lead Card (redesign) ===== */

/* Action buttons in right panel */
.lead-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.lead-action-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
}

.lead-action-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.lead-action-danger {
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.15) !important;
}

.lead-action-danger:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
}

/* Tab buttons */
.lead-tab {
    transition: color 0.2s, border-color 0.2s;
}

.lead-tab.active {
    color: var(--text-primary) !important;
    border-bottom-color: #7C3AED !important;
}

.lead-tab:hover:not(.active) {
    color: var(--text-secondary) !important;
}

/* Chat bubbles redesign */
.chat-bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.83rem;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
}

.chat-bubble.user {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 14px 14px 14px 4px;
}

.chat-bubble.me {
    align-self: flex-end;
    background: linear-gradient(135deg, #6D28D9 0%, #7C3AED 100%);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}

.chat-bubble-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.chat-bubble-author {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.chat-bubble-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.chat-bubble-time {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
    margin-top: 4px;
}
.chat-bubble.user .chat-bubble-time {
    color: var(--text-muted);
}

/* Chat input */
#chat-reply-input:focus {
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

#btn-send-chat-reply:hover {
    background: #8B5CF6 !important;
    transform: scale(1.05);
}

/* Redesigned Lead Card & Chat styles */
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f3f4f6;
    flex-shrink: 0;
}

.chat-message-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    width: 100%;
}

.chat-message-row.me {
    justify-content: flex-end;
}

.chat-bubble.me {
    background: linear-gradient(135deg, #6D28D9 0%, #7C3AED 100%);
    color: #fff;
    border-radius: 12px 12px 4px 12px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
    padding: 10px 14px;
    font-size: 0.83rem;
    max-width: 70%;
    line-height: 1.5;
    position: relative;
    border: none;
}

.chat-bubble.user {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 4px 12px 12px 12px;
    padding: 10px 14px;
    font-size: 0.83rem;
    max-width: 85%;
    line-height: 1.5;
}

#modal-lead-notes:focus {
    border-color: rgba(124, 58, 237, 0.4) !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}
