/* Base styles and variables */
:root {
    --bg-dark: #212121;
    --bg-lighter: #2a2a2a;
    --text: #f1f1f1;
    --text-muted: #a0a0a0;
    --border: #444444;
    --accent: #ab68ff;
    --bubble-user: #343541;
    --bubble-assistant: #2a2a2a;
    --shadow: rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
}

/* Top bar styling */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.logo i {
    color: var(--accent);
}

/* Button styling */
.btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.btn.primary:hover {
    opacity: 0.9;
}

/* Chat container styling */
.chat-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Message styling */
.msg {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg.assistant {
    align-self: flex-start;
}

.avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.avatar-icon {
    width: 100%;
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.bubble {
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--bubble-assistant);
    position: relative;
    font-size: 14px;
}

.msg.user .bubble {
    background: var(--bubble-user);
}

.typing {
    opacity: 0.7;
}

.typing-animation {
    display: flex;
    gap: 4px;
}

.typing-animation span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-animation span:nth-child(1) {
    animation-delay: 0s;
}

.typing-animation span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-animation span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.6;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area styling */
.input-container {
    padding: 16px;
    border-top: 1px solid var(--border);
    background-color: var(--bg-dark);
    position: sticky;
    bottom: 0;
}

.input-box {
    display: flex;
    align-items: center;
    background-color: var(--bg-lighter);
    border-radius: 8px;
    padding: 8px 12px;
    gap: 8px;
}

.input-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 14px;
    outline: none;
    padding: 4px 0;
}

.input-box input::placeholder {
    color: var(--text-muted);
}

.attachment-btn, .send-btn, .dropdown-trigger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

/* Dropdown styling */
.dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 50px;
    background: var(--bg-lighter);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    width: 240px;
    margin-bottom: 8px;
    display: none;
    z-index: 100;
    overflow: hidden;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-section {
    border-bottom: 1px solid var(--border);
}

.dropdown-section:last-child {
    border-bottom: none;
}

.dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-dark);
    font-size: 14px;
}

.dropdown-options {
    max-height: 150px;
    overflow-y: auto;
}

.dropdown-option {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

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

.dropdown-option.selected {
    background: rgba(171, 104, 255, 0.1);
    color: var(--accent);
}

/* Selected options styling */
.selected-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    position: absolute;
    top: 8px;
    left: 80px;
    right: 50px;
    pointer-events: none;
}

.selected-tag {
    background: rgba(171, 104, 255, 0.2);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.selected-tag .remove {
    cursor: pointer;
    pointer-events: auto;
}

/* File preview and upload styles */
.file-preview {
    background: var(--bg-lighter);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-info i {
    font-size: 20px;
    color: var(--accent);
}

.file-size {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 8px;
}

.upload-btn, .cancel-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-btn {
    color: var(--accent);
}

.cancel-btn {
    color: var(--text-muted);
}

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

/* Progress bar styles */
.file-name {
    margin-bottom: 8px;
    font-weight: 500;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

.send-btn {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.disclaimer {
    text-align: center;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Table styling for contact data */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* CSV display styling */
.csv-display {
    white-space: pre;
    overflow-x: auto;
    font-family: monospace;
    font-size: 11px;
    padding: 12px;
    background: var(--bg-lighter);
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-muted);
}

/* List styling */
ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

li {
    margin-bottom: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .msg {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .msg {
        max-width: 100%;
    }
    
    .message-list {
        padding: 12px;
    }
    
    .input-container {
        padding: 12px;
    }
}