:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f3f4f6;
    --sidebar-bg: #1f2937;
    --sidebar-text: #d1d5db;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --bg-secondary: #f9fafb;
    /* Light gray for headers/filters */
    color-scheme: light;
}

/* Filter Button Styles (Compact & Colorful) */
.filter-btn {
    border: 1px solid transparent;
    background: var(--white);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    /* Smaller font */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.filter-btn:hover {
    transform: translateY(-1px);
}

/* Specific Colors */
.filter-all.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.filter-new.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Blue */
.filter-lead.active {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* Green */
.filter-closed.active {
    background: #374151;
    color: white;
    border-color: #374151;
}

/* Gray */
.filter-spam.active {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* Red */

/* Status Dropdown (Modern) */
.status-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 8px 32px 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s;
}

.status-select:hover {
    border-color: #d1d5db;
}

.status-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Delete Button (Soft Red Square) */
.btn-icon-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: #fef2f2;
    /* Soft Red */
    border: 1px solid #fee2e2;
    color: #ef4444;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-icon-danger:hover {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
    transform: translateY(-1px);
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Active Filter State */
.filter-btn.active {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

[data-theme="dark"] .login-container {
    background: var(--card-bg);
}

[data-theme="dark"] #chatSearchInput {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Dashicons fix for dark mode */
[data-theme="dark"] .dashicons {
    color: var(--text-primary);
}

/* Active Conversation Item */
.conversation-item:hover,
.conversation-item.active-conv {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .conversation-item:hover,
[data-theme="dark"] .conversation-item.active-conv {
    background-color: var(--input-bg);
}

/* Layout */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.dashboard-wrapper {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand .dashicons {
    margin-right: 0.5rem;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border-left: 3px solid var(--primary-color);
}

.sidebar-nav .dashicons {
    margin-right: 0.75rem;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 64px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* UI Elements */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #f9fafb;
}

.btn-logout {
    color: #ef4444;
    text-decoration: none;
    font-size: 0.875rem;
    margin-left: 1rem;
}

.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Button Sizes */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    height: 28px;
}

.btn-white {
    background-color: var(--white);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-white:hover {
    background-color: #f9fafb;
    color: var(--text-primary);
    border-color: #d1d5db;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: #f9fafb;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Button Sizes */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8125rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 6px;
}

/* Button Variants */
.btn-white {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-white:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    color: var(--primary-color);
}

/* Theme Toggle Button Specific */
#themeToggle {
    color: var(--text-primary) !important;
}

#themeToggle .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 1.7;
}

/* Action Groups */
.action-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-wrap: nowrap;
}

/* Table Polish */
th,
td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
}

tbody tr {
    transition: background-color 0.1s;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child {
    border-bottom: none;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    border-collapse: separate;
    border-radius: 8px;
    transition: all 0.2s;
}

.site-access-row:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.status-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

/* Pill Checkboxes */
.status-pill {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.status-pill input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.status-pill span {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #f3f4f6;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.status-pill:hover span {
    background-color: #e5e7eb;
}

/* Checked States */
.status-pill input:checked+span {
    border-color: transparent;
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.status-pill.new input:checked+span {
    background-color: #3b82f6;
}

.status-pill.lead input:checked+span {
    background-color: #22c55e;
}

.status-pill.closed input:checked+span {
    background-color: #6b7280;
}

.status-pill.spam input:checked+span {
    background-color: #ef4444;
}

/* Proper Button Styling */
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    width: 100%;
    justify-content: center;
}


/* =========================================
   Chat View Styles
   ========================================= */

/* Message Header */
.message-header {
    background: #ffffff;
}

[data-theme="dark"] .message-header {
    background: var(--card-bg);
    /* or #1f2937 */
    border-bottom-color: var(--border-color);
}

/* Background */
.chat-background {
    background-color: #e5ddd5;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    /* WhatsApp Doodle */
    background-repeat: repeat;
}

[data-theme="dark"] .chat-background {
    background-color: #0b1120;
    /* Very dark blue */
    background-image: none;
    /* Remove doodle in dark mode for cleanliness */
    /* Optional: Add a dark pattern or simple dark bg */
}

/* Message Bubble */
.message-bubble {
    background: #ffffff;
    color: #111827;
}

[data-theme="dark"] .message-bubble {
    background: #1f2937;
    /* Dark grayish blue */
    color: #f3f4f6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Triangle */
.message-triangle {
    border-top: 10px solid #ffffff;
}

[data-theme="dark"] .message-triangle {
    border-top: 10px solid #1f2937;
}

/* Message Meta (Form Data) */
.message-meta {
    color: #4b5563;
}

[data-theme="dark"] .message-meta {
    color: #9ca3af;
    border-top-color: #374151 !important;
}

.message-time {
    color: #9ca3af;
}

/* Internal Notes */
.note-item {
    background: #fff9c4;
    border: 1px solid #fde047;
    color: #4b5563;
}

[data-theme="dark"] .note-item {
    background: #374151;
    /* Dark gray */
    border: 1px solid #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] .note-item strong,
[data-theme="dark"] .note-item span {
    color: #f3f4f6 !important;
}

/* Checkbox Toggle */
/* ... existing styles ... */