/* ContactWave - Main Stylesheet */
/* WhatsApp-inspired design with green/teal color scheme */

:root {
    /* Primary Colors */
    --primary-color: #25D366;
    --primary-dark: #128C7E;
    --primary-darker: #075E54;
    --primary-light: #DCF8C6;
    
    /* Secondary Colors */
    --secondary-color: #34B7F1;
    --accent-color: #00A884;
    
    /* Neutral Colors */
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --border-color: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #667781;
    --text-muted: #8696a0;
    
    /* Status Colors */
    --success-color: #25D366;
    --warning-color: #FFC107;
    --error-color: #DC3545;
    --info-color: #17A2B8;
    
    /* Message Colors */
    --message-out-bg: #d9fdd3;
    --message-in-bg: #ffffff;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    
    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --border-radius: 10px;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.w-100 {
    width: 100%;
}

.text-center {
    text-align: center;
}

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

.text-error {
    color: var(--error-color);
}

.text-success {
    color: var(--success-color);
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .menu-text,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .user-details {
    display: none;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 8px;
    transition: background var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-color);
}

.sidebar-menu {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    margin-bottom: 4px;
    transition: all var(--transition-fast);
    position: relative;
}

.menu-item:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1), rgba(18, 140, 126, 0.1));
    color: var(--primary-dark);
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.menu-text {
    flex: 1;
    font-size: 14px;
}

.menu-badge {
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-top: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-tenant {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-branding {
    text-align: center;
    padding: 8px 16px 4px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
}

.sidebar-branding a {
    font-size: 10px;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.sidebar-branding a:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Panel Container */
.panel-container {
    flex: 1;
    overflow: hidden;
}

.panel {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
}

.panel.active {
    display: block;
}

.panel-content {
    max-width: 1400px;
    margin: 0 auto;
}

.panel-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1), rgba(18, 140, 126, 0.1));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-color);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 211, 102, 0.05);
}

.action-icon {
    font-size: 28px;
}

.action-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    transition: background var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-color);
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.select-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    min-width: 150px;
}

.search-box input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 250px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Data Tables */
.data-table-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

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

.data-table tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

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

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.sent {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
}

.status-badge.delivered {
    background: rgba(37, 211, 102, 0.1);
    color: var(--success-color);
}

.status-badge.read {
    background: rgba(37, 211, 102, 0.2);
    color: var(--primary-dark);
}

.status-badge.failed {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
}

.status-badge.pending {
    background: rgba(255, 193, 7, 0.1);
    color: #B7950B;
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.template-card:hover {
    border-color: var(--primary-color);
}

.template-card.approved {
    border-left: 4px solid var(--success-color);
}

.template-card.pending {
    border-left: 4px solid var(--warning-color);
}

.template-card.rejected {
    border-left: 4px solid var(--error-color);
}

.template-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
}

.template-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.template-preview {
    background: var(--bg-color);
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    max-height: 100px;
    overflow: hidden;
}

/* Inbox Layout */
.inbox-layout {
    display: flex;
    height: calc(100vh - var(--header-height) - 48px);
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.conversation-list-container {
    width: 350px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.inbox-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.inbox-search {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
}

.inbox-filters {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

.filter-btn {
    padding: 6px 14px;
    background: var(--bg-color);
    border: none;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

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

.conversation-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.conversation-item:hover {
    background: var(--bg-color);
}

.conversation-item.active {
    background: rgba(37, 211, 102, 0.1);
}

.conversation-item.unread {
    background: rgba(37, 211, 102, 0.05);
}

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

.conversation-name {
    font-weight: 600;
    font-size: 15px;
}

.conversation-time {
    font-size: 12px;
    color: var(--text-muted);
}

.conversation-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-badge {
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Message Thread */
.message-thread-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e5ddd5;
}

.thread-header {
    padding: 16px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thread-contact h3 {
    font-size: 16px;
    margin-bottom: 2px;
}

.thread-contact p {
    font-size: 13px;
    color: var(--text-muted);
}

.thread-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    display: flex;
    max-width: 65%;
}

.message.outbound {
    align-self: flex-end;
}

.message.inbound {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
}

.message.outbound .message-bubble {
    background: var(--message-out-bg);
    border-bottom-right-radius: 4px;
}

.message.inbound .message-bubble {
    background: var(--message-in-bg);
    border-bottom-left-radius: 4px;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-status {
    font-size: 14px;
    color: var(--text-muted);
}

.message-status.read {
    color: var(--secondary-color);
}

.thread-input {
    padding: 12px 20px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.thread-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    resize: none;
    font-size: 14px;
    max-height: 120px;
}

.thread-input button {
    padding: 12px 24px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Settings */
.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-box {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.info-box code {
    display: block;
    background: white;
    padding: 10px 14px;
    border-radius: 6px;
    margin-top: 8px;
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--info-color);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 12px;
}

.contacts-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .inbox-layout {
        flex-direction: column;
    }
    
    .conversation-list-container {
        width: 100%;
        height: 40%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100%;
        transition: left var(--transition-normal);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .panel {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .panel-header-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .data-table-container {
        overflow-x: auto;
    }
    
    .modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
}

/* ========================================
   CSS FIXES - v3.0
   Dropdowns, Form Controls, 24-Hour Window
   ======================================== */

/* ==================== DROPDOWN FIXES ==================== */

/* Base select/dropdown styling - Make them bigger and more visible */
select.form-control,
.form-control[type="select"],
select {
    min-height: 44px;
    padding: 10px 40px 10px 15px;
    font-size: 15px;
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-color: var(--card-bg, #ffffff);
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><path fill="%23667781" d="M7 10L2 5h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 14px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    transition: all 0.2s ease;
}

select.form-control:hover,
select:hover {
    border-color: var(--primary-color, #25D366);
    background-color: #f8f9fa;
}

select.form-control:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color, #25D366);
    box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.15);
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><path fill="%2325D366" d="M7 10L2 5h10z"/></svg>');
}

/* Dropdown options */
select option {
    padding: 12px 15px;
    font-size: 14px;
    background: white;
    color: #333;
}

/* Small dropdown variant */
select.form-control-sm,
.form-control-sm {
    min-height: 38px;
    padding: 8px 35px 8px 12px;
    font-size: 14px;
    border-radius: 6px;
}

/* Large dropdown variant */
select.form-control-lg,
.form-control-lg {
    min-height: 52px;
    padding: 14px 45px 14px 18px;
    font-size: 16px;
    border-radius: 10px;
}

/* Specific dropdown contexts */
#filter-campaign,
#filter-status,
#history-campaign-filter,
#history-status-filter,
#delete-campaign-select {
    min-width: 200px;
    min-height: 44px;
}

/* ==================== INPUT FIELD FIXES ==================== */

/* Make all inputs consistent and larger */
input.form-control,
textarea.form-control {
    min-height: 44px;
    padding: 10px 15px;
    font-size: 15px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    transition: all 0.2s ease;
}

input.form-control:hover,
textarea.form-control:hover {
    border-color: #c0c0c0;
}

input.form-control:focus,
textarea.form-control:focus {
    outline: none;
    border-color: var(--primary-color, #25D366);
    box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.15);
}

/* ==================== INBOX 24-HOUR WINDOW STYLES ==================== */

/* Window indicator in conversation list */
.window-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    margin-left: 5px;
    vertical-align: middle;
}

.window-indicator.open {
    color: #2ecc71;
}

.window-indicator.closed {
    color: #e74c3c;
}

/* Window status bar in message thread */
.window-status-bar {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-bottom: 1px solid #e9ecef;
}

.window-status-bar.window-open {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 4px solid #28a745;
}

.window-status-bar.window-closed {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-left: 4px solid #dc3545;
}

.window-status-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.window-status-icon {
    font-size: 16px;
}

.window-status-title {
    font-weight: 600;
    font-size: 14px;
}

.window-status-bar.window-open .window-status-title {
    color: #155724;
}

.window-status-bar.window-closed .window-status-title {
    color: #721c24;
}

.window-status-time {
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.window-status-bar.window-open .window-status-time {
    background: rgba(40, 167, 69, 0.2);
    color: #155724;
}

.window-status-bar.window-closed .window-status-time {
    background: rgba(220, 53, 69, 0.2);
    color: #721c24;
}

.window-status-details {
    font-size: 12px;
    opacity: 0.8;
    padding-left: 26px;
}

/* Window closed notice in input area */
.window-closed-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #fff3cd;
    border-top: 2px solid #ffc107;
    text-align: center;
    flex-wrap: wrap;
    width: 100%;
}

.window-closed-notice .notice-icon {
    font-size: 24px;
}

.window-closed-notice .notice-text {
    color: #856404;
    font-size: 14px;
    font-weight: 500;
}

/* Thread input when window is closed */
.thread-input.window-closed {
    padding: 0;
    background: transparent;
    border-top: none;
}

/* Thread notice styling */
.thread-notice {
    padding: 10px 16px;
    font-size: 12px;
    text-align: center;
}

.thread-notice.notice-success {
    background: #d4edda;
    border-top: 1px solid #c3e6cb;
    color: #155724;
}

.thread-notice.notice-warning {
    background: #fff3cd;
    border-top: 1px solid #ffeaa7;
    color: #856404;
}

/* ==================== MESSAGE TIME DISPLAY ==================== */

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    cursor: default;
}

.message.outbound .message-time {
    color: rgba(0, 0, 0, 0.45);
}

/* Tooltip for full date/time */
.message-time[title] {
    cursor: help;
    border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
}

/* ==================== RESPONSIVE DROPDOWN FIXES ==================== */

@media (max-width: 768px) {
    select.form-control,
    select {
        min-height: 48px;
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px 40px 12px 15px;
    }
    
    .window-closed-notice {
        flex-direction: column;
        gap: 10px;
    }
    
    .window-status-bar {
        padding: 10px 15px;
    }
    
    .filter-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==================== BUTTON CONSISTENCY ==================== */

/* Ensure buttons match dropdown heights */
.btn {
    min-height: 44px;
}

.btn-sm {
    min-height: 36px;
}

.btn-lg {
    min-height: 52px;
}

/* ==================== FORM GROUP IMPROVEMENTS ==================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label,
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

/* ==================== STATUS BADGES ==================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.pending {
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
}

.status-badge.sent {
    background: rgba(23, 162, 184, 0.15);
    color: #0c5460;
}

.status-badge.delivered {
    background: rgba(37, 211, 102, 0.15);
    color: #155724;
}

.status-badge.read {
    background: rgba(18, 140, 126, 0.15);
    color: #075e54;
}

.status-badge.failed {
    background: rgba(220, 53, 69, 0.15);
    color: #721c24;
}

/* ==================== CARD FOOTER ==================== */

.card-footer {
    padding: 16px 20px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

/* ==================== UTILITY CLASSES ==================== */

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

/* ==================== CUSTOM DIALOG SYSTEM ==================== */

.app-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: dialogOverlayIn 0.2s ease;
    backdrop-filter: blur(2px);
}

.app-dialog-overlay.closing {
    animation: dialogOverlayOut 0.2s ease forwards;
}

@keyframes dialogOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialogOverlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.app-dialog {
    background: var(--card-bg, white);
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: dialogSlideIn 0.25s ease;
    overflow: hidden;
}

.app-dialog-overlay.closing .app-dialog {
    animation: dialogSlideOut 0.2s ease forwards;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes dialogSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

.dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.app-dialog.info .dialog-header {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.1) 0%, rgba(23, 162, 184, 0.05) 100%);
}

.app-dialog.warning .dialog-header {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.05) 100%);
}

.app-dialog.danger .dialog-header {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
}

.app-dialog.success .dialog-header {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.1) 0%, rgba(37, 211, 102, 0.05) 100%);
}

.dialog-icon {
    font-size: 28px;
    line-height: 1;
}

.dialog-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    margin: 0;
}

.dialog-body {
    padding: 20px 24px;
}

.dialog-message {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary, #667781);
    margin: 0;
    word-break: break-word;
}

.dialog-input-wrapper {
    margin-top: 16px;
}

.dialog-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    transition: all 0.2s ease;
    background: var(--bg-color, #f0f2f5);
}

.dialog-input:focus {
    outline: none;
    border-color: var(--primary-color, #25D366);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.15);
}

.dialog-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 20px;
    justify-content: flex-end;
    background: var(--bg-color, #f8f9fa);
}

.dialog-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.dialog-cancel {
    background: white;
    border: 2px solid var(--border-color, #e0e0e0);
    color: var(--text-secondary, #667781);
}

.dialog-cancel:hover {
    background: var(--bg-color, #f0f2f5);
    border-color: #ccc;
}

.dialog-confirm.btn-primary {
    background: linear-gradient(135deg, var(--primary-color, #25D366) 0%, var(--primary-dark, #128C7E) 100%);
    color: white;
    border: none;
}

.dialog-confirm.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.dialog-confirm.btn-danger {
    background: linear-gradient(135deg, #DC3545 0%, #c82333 100%);
    color: white;
    border: none;
}

.dialog-confirm.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* ==================== UI IMPROVEMENTS ==================== */

/* Cleaner page headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Improved cards */
.card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Better stat cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue { background: rgba(52, 183, 241, 0.15); color: #34B7F1; }
.stat-icon.green { background: rgba(37, 211, 102, 0.15); color: #25D366; }
.stat-icon.orange { background: rgba(255, 159, 10, 0.15); color: #FF9F0A; }
.stat-icon.red { background: rgba(220, 53, 69, 0.15); color: #DC3545; }

/* Improved tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: rgba(37, 211, 102, 0.03);
}

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

/* Cleaner buttons */
.btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-outline {
    background: transparent;
    border: 2px solid currentColor;
}

/* Better empty states */
.empty-state {
    padding: 60px 20px;
    text-align: center;
}

.empty-state .empty-icon {
    font-size: 72px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Filter bars */
.filter-bar {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar .form-control {
    min-width: 180px;
}

/* Search input improvements */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 44px;
    border-radius: 24px;
    background: var(--bg-color);
    border: 2px solid transparent;
}

.search-box input:focus {
    background: white;
    border-color: var(--primary-color);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.5;
    pointer-events: none;
}

/* Quick action improvements */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.quick-action-btn {
    padding: 20px 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: white;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 211, 102, 0.05);
    transform: translateY(-2px);
}

.quick-action-btn .action-icon {
    font-size: 32px;
}

.quick-action-btn .action-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Badge improvements */
.badge, .menu-badge, .conversation-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    min-width: 22px;
    text-align: center;
}

/* Scrollbar improvements */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Panel content max width for better readability */
.panel {
    padding: 24px;
}

.panel-content {
    max-width: 1400px;
    margin: 0 auto;
}

/* Improved form layout */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Action buttons in tables */
.table-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.table-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* Loading states */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Mobile improvements */
@media (max-width: 768px) {
    .app-dialog {
        width: 95%;
        margin: 16px;
    }
    
    .dialog-footer {
        flex-direction: column-reverse;
    }
    
    .dialog-btn {
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar .form-control {
        width: 100%;
    }
}

/* ==================== ENHANCED INBOX STYLES ==================== */

.inbox-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 48px);
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.inbox-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inbox-title .inbox-icon {
    font-size: 28px;
}

.inbox-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 0;
}

.inbox-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inbox-search-box {
    position: relative;
}

.inbox-search-box input {
    width: 280px;
    padding: 10px 16px;
    border-radius: 24px;
    background: var(--bg-color);
    border: 2px solid transparent;
    font-size: 14px;
}

.inbox-search-box input:focus {
    background: white;
    border-color: var(--primary-color);
    outline: none;
}

/* Sync Status Bar */
.sync-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    font-size: 12px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.sync-status-bar.active .sync-dot {
    background: #2ecc71;
}

.sync-status-bar.paused .sync-dot {
    background: #f39c12;
    animation: none;
}

.sync-status-bar.error .sync-dot {
    background: #e74c3c;
    animation: none;
}

.sync-text {
    color: var(--text-secondary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Filter Tabs */
.inbox-filter-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    flex-shrink: 0;
}

.filter-tab {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-color);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-tab:hover {
    background: #e8e8e8;
}

.filter-tab.active {
    background: var(--primary-color);
    color: white;
}

/* Inbox Layout */
.inbox-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.conversation-list-panel {
    width: 380px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
}

.message-thread-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e5ddd5;
}

/* Conversation Item - Enhanced */
.conversation-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

.conversation-item:hover {
    background: #f8f9fa;
}

.conversation-item.active {
    background: rgba(37, 211, 102, 0.1);
    border-left: 4px solid var(--primary-color);
    padding-left: 12px;
}

.conversation-item.unread {
    background: #f8f9fa;
}

.conversation-item.unread .conversation-name {
    font-weight: 600;
}

.conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-icon {
    font-size: 24px;
    filter: grayscale(1) brightness(10);
}

.conversation-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.conversation-name .star-icon {
    font-size: 12px;
}

.conversation-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conversation-time {
    font-size: 12px;
    color: var(--text-muted);
}

.conversation-preview {
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-icon {
    font-size: 12px;
    opacity: 0.6;
}

.preview-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conversation-badge {
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 22px;
    text-align: center;
}

/* Thread Header - Enhanced */
.thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.thread-contact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thread-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    filter: grayscale(1) brightness(10);
}

.thread-contact-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 2px 0;
}

.thread-contact-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.thread-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.thread-actions .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.thread-actions .btn-icon:hover {
    background: var(--bg-color);
}

.thread-actions .btn-icon.active {
    background: rgba(255, 193, 7, 0.2);
}

.thread-actions .status-btn.resolved {
    background: rgba(46, 204, 113, 0.2);
}

/* Thread Dropdown */
.thread-actions-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    padding: 8px 0;
    z-index: 100;
    display: none;
}

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

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--bg-color);
}

.dropdown-item.danger {
    color: var(--error-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Thread Placeholder */
.thread-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #d4cfc5;
}

.placeholder-icon {
    font-size: 80px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.thread-placeholder p {
    font-size: 16px;
    color: #667781;
}

/* ==================== GROUP SELECTOR IMPROVEMENTS ==================== */

.group-selector-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-search-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-search-box input {
    flex: 1;
    max-width: 400px;
}

.group-count-badge {
    padding: 6px 14px;
    background: var(--bg-color);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.group-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.group-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.group-card:hover {
    border-color: var(--primary-color);
    background: rgba(37, 211, 102, 0.03);
}

.group-card.selected {
    border-color: var(--primary-color);
    background: rgba(37, 211, 102, 0.1);
}

.group-card-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 700;
    flex-shrink: 0;
}

.group-card.selected .group-card-check {
    background: var(--primary-color);
    color: white;
}

.group-card-content {
    flex: 1;
    min-width: 0;
}

.group-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-card-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.group-card-count .contact-count {
    font-weight: 600;
    color: var(--primary-dark);
}

.group-selection-summary {
    padding: 16px;
    background: var(--bg-color);
    border-radius: 10px;
    text-align: center;
}

.summary-selected {
    color: var(--success-color);
    font-size: 14px;
}

.summary-none {
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== TABLE IMPROVEMENTS ==================== */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 14px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(37, 211, 102, 0.03);
}

/* ==================== LARGER DROPDOWNS ==================== */

select.form-control,
.form-control[type="select"] {
    min-height: 48px;
    padding: 12px 45px 12px 16px;
    font-size: 15px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667781' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    cursor: pointer;
}

select.form-control:hover {
    border-color: var(--primary-color);
}

select.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2325D366' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* All form inputs */
input.form-control,
textarea.form-control {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 15px;
}

/* Filter grid dropdowns */
.filter-grid select {
    min-width: 180px;
}

/* Responsive: Larger touch targets on mobile */
@media (max-width: 768px) {
    select.form-control,
    input.form-control,
    textarea.form-control {
        min-height: 52px;
        font-size: 16px;
    }
    
    .inbox-layout {
        flex-direction: column;
    }
    
    .conversation-list-panel {
        width: 100%;
        height: 50%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .message-thread-panel {
        height: 50%;
    }
    
    .inbox-search-box input {
        width: 100%;
    }
    
    .group-selector {
        grid-template-columns: 1fr;
        max-height: 300px;
    }
}

/* ==================== ADDITIONAL UI POLISH ==================== */

/* Loading spinner */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-state .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Card improvements */
.card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

/* ==================== CAMPAIGN DETAILS MODAL ==================== */

.campaign-details-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.campaign-details-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 1200px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    margin: 20px 0;
}

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

/* CDM Header */
.cdm-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.cdm-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdm-title-icon {
    font-size: 28px;
}

.cdm-subtitle {
    margin: 8px 0 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.cdm-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.cdm-close-btn:hover {
    color: var(--text-primary);
}

/* CDM Overview Section */
.cdm-overview {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    color: white;
}

.cdm-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cdm-overview-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Info Cards */
.cdm-info-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.cdm-info-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.cdm-info-icon {
    font-size: 28px;
    opacity: 0.9;
}

.cdm-info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.cdm-info-value {
    font-size: 14px;
    font-weight: 600;
}

/* Stats Row */
.cdm-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 24px;
}

.cdm-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid;
}

.cdm-stat-card.blue {
    background: rgba(52, 183, 241, 0.1);
    border-color: rgba(52, 183, 241, 0.3);
}

.cdm-stat-card.green {
    background: rgba(37, 211, 102, 0.1);
    border-color: rgba(37, 211, 102, 0.3);
}

.cdm-stat-card.red {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
}

.cdm-stat-card.yellow {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.3);
}

.cdm-stat-icon {
    font-size: 32px;
}

.cdm-stat-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.cdm-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Success Rate */
.cdm-success-rate {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.cdm-success-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.cdm-success-percentage {
    font-size: 32px;
    font-weight: 700;
}

.cdm-progress-bar {
    height: 12px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.cdm-progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.cdm-success-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.legend-dot.green { background: #25D366; }
.legend-dot.red { background: #f44336; }

/* Recipients Section */
.cdm-recipients {
    padding: 24px;
}

.cdm-recipients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cdm-recipients-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Filters */
.cdm-recipients-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.cdm-filter-tabs {
    display: flex;
    gap: 8px;
}

.cdm-filter-tab {
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-color);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cdm-filter-tab:hover {
    background: #e0e0e0;
}

.cdm-filter-tab.active {
    background: var(--primary-color);
    color: white;
}

.cdm-filter-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cdm-search-box {
    position: relative;
}

.cdm-search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
}

.cdm-search-box input {
    padding-left: 40px;
    min-width: 280px;
}

.cdm-per-page {
    min-width: 140px;
}

/* Table */
.cdm-table-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.cdm-table-info {
    padding: 12px 16px;
    background: var(--bg-color);
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.cdm-table {
    width: 100%;
    border-collapse: collapse;
}

.cdm-table thead th {
    background: white;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.cdm-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.cdm-table tbody tr:hover {
    background: rgba(37, 211, 102, 0.03);
}

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

.phone-number {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
    background: var(--bg-color);
    padding: 4px 10px;
    border-radius: 6px;
}

.cdm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.details-cell {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 11px;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer */
.cdm-footer {
    padding: 20px 24px;
    background: var(--bg-color);
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 992px) {
    .cdm-info-cards,
    .cdm-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .campaign-details-modal-overlay {
        padding: 10px;
    }
    
    .cdm-info-cards,
    .cdm-stats-row {
        grid-template-columns: 1fr;
    }
    
    .cdm-recipients-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cdm-filter-tabs {
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .cdm-filter-right {
        flex-direction: column;
    }
    
    .cdm-search-box input {
        min-width: 100%;
    }
    
    .cdm-table-wrapper {
        overflow-x: auto;
    }
    
    .cdm-table {
        min-width: 700px;
    }
}

/* ==================== ENHANCED HISTORY MODULE ==================== */

/* History Page Layout */
.history-page {
    padding: 0;
}

/* Analytics Section */
.history-analytics {
    margin-bottom: 24px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.analytics-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.analytics-card.wide {
    grid-column: span 1;
}

.analytics-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.analytics-card-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-card-body {
    padding: 20px;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

/* Status Breakdown Chart */
.status-breakdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.donut-chart {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

.donut {
    width: 100%;
    height: 100%;
}

.donut circle {
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dasharray 0.3s ease;
}

.donut-center-text {
    font-size: 8px;
    font-weight: 700;
    fill: var(--text-primary);
    text-anchor: middle;
    dominant-baseline: middle;
}

.donut-center-label {
    font-size: 3.5px;
    fill: var(--text-secondary);
    text-anchor: middle;
}

.status-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.sent { background: #17a2b8; }
.legend-color.delivered { background: #25D366; }
.legend-color.read { background: #128c7e; }
.legend-color.failed { background: #f44336; }

.legend-label {
    flex: 1;
    color: var(--text-secondary);
}

.legend-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Funnel Visualization */
.funnel-rates {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.funnel-rate-row {
    width: 100%;
}

.funnel-rate-bar {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    box-sizing: border-box;
    min-width: 200px;
}

.funnel-rate-bar.sent { background: linear-gradient(90deg, #17a2b8 0%, #138496 100%); }
.funnel-rate-bar.delivered { background: linear-gradient(90deg, #25D366 0%, #1ebe5d 100%); }
.funnel-rate-bar.read { background: linear-gradient(90deg, #128c7e 0%, #0d6e63 100%); }
.funnel-rate-bar.failed { background: linear-gradient(90deg, #f44336 0%, #d32f2f 100%); }

.funnel-rate-label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.funnel-rate-value {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.funnel-rate-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    display: block;
    padding-left: 4px;
}

/* Delete Campaign Card */
.delete-campaign-card {
    border: 2px solid rgba(244, 67, 54, 0.3);
    background: rgba(244, 67, 54, 0.02);
    margin-bottom: 24px;
}

.delete-campaign-card .card-header {
    background: rgba(244, 67, 54, 0.05);
}

.delete-campaign-card .card-title {
    color: #d32f2f;
}

.delete-warning {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.delete-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.delete-select {
    flex: 1;
}

.delete-select label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Filter Card */
.history-filters-card {
    margin-bottom: 24px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* Auto Refresh Toggle */
.auto-refresh-toggle {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.toggle-text {
    color: var(--text-secondary);
}

.refresh-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    transition: background 0.3s;
}

.refresh-indicator.active {
    background: #25D366;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table thead th {
    background: var(--bg-color);
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.history-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.history-table tbody tr:hover {
    background: rgba(37, 211, 102, 0.04);
}

.history-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    vertical-align: middle;
}

.history-row {
    cursor: pointer;
}

/* Contact Cell */
.contact-cell {
    min-width: 160px;
}

.contact-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.contact-phone {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, monospace;
}

/* Campaign Badge */
.campaign-badge {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campaign-badge:hover {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    transform: translateY(-1px);
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pill.sent {
    background: rgba(23, 162, 184, 0.15);
    color: #0c5460;
}

.status-pill.delivered {
    background: rgba(37, 211, 102, 0.15);
    color: #155724;
}

.status-pill.read {
    background: rgba(18, 140, 126, 0.2);
    color: #075e54;
}

.status-pill.failed {
    background: rgba(244, 67, 54, 0.15);
    color: #721c24;
}

.status-pill.pending {
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
}

/* Timeline Cell */
.timeline-cell {
    min-width: 180px;
}

.timeline-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.timeline-entry:last-child {
    margin-bottom: 0;
}

.timeline-entry.error {
    color: #d32f2f;
}

.timeline-icon {
    font-size: 12px;
}

.timeline-time {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
}

/* Message ID Cell */
.message-id-cell {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
    color: var(--text-muted);
    max-width: 150px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== MESSAGE DETAILS MODAL ==================== */

.message-details-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.message-details-modal-overlay.hidden {
    display: none;
}

.message-details-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.mdm-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mdm-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mdm-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mdm-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mdm-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.mdm-field {
    margin-bottom: 20px;
}

.mdm-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.mdm-value {
    font-size: 15px;
    color: var(--text-primary);
}

.mdm-message-id {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    background: var(--bg-color);
    padding: 8px 12px;
    border-radius: 6px;
    word-break: break-all;
}

/* Message Details Timeline */
.mdm-timeline {
    background: var(--bg-color);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 24px;
}

.mdm-timeline-header {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mdm-timeline-body {
    padding: 20px;
}

.mdm-timeline-item {
    display: flex;
    gap: 16px;
    position: relative;
    padding-bottom: 20px;
}

.mdm-timeline-item:last-child {
    padding-bottom: 0;
}

.mdm-timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 36px;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.mdm-timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mdm-timeline-content {
    flex: 1;
    padding-top: 4px;
}

.mdm-timeline-status {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.mdm-timeline-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.mdm-timeline-error {
    margin-top: 8px;
    padding: 10px 14px;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: #d32f2f;
    border-left: 3px solid #f44336;
}

/* Loading placeholder */
.loading-placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 992px) {
    .analytics-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .analytics-card.wide {
        grid-column: span 2;
    }
    
    .filter-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-card.wide {
        grid-column: span 1;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .delete-row {
        flex-direction: column;
    }
    
    .delete-row .btn {
        width: 100%;
    }
    
    .status-breakdown {
        flex-direction: column;
        text-align: center;
    }
    
    .history-table {
        display: block;
        overflow-x: auto;
    }
    
    .message-details-modal {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}

/* ==================== CLEAN DASHBOARD ==================== */

.dashboard-page {
    padding: 0;
}

.dashboard-page .page-header {
    margin-bottom: 24px;
}

.dashboard-page .page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* Dashboard Stats Grid */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.stat-icon-wrapper.blue { background: rgba(99, 102, 241, 0.15); }
.stat-icon-wrapper.pink { background: rgba(236, 72, 153, 0.15); }
.stat-icon-wrapper.green { background: rgba(37, 211, 102, 0.15); }
.stat-icon-wrapper.orange { background: rgba(249, 115, 22, 0.15); }

.stat-icon {
    font-size: 24px;
}

.dashboard-stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dashboard-stat-card .stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Dashboard Content Row */
.dashboard-content-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Dashboard Cards */
.dashboard-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

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

.dashboard-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.view-all-link {
    font-size: 14px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

.dashboard-card-body {
    padding: 20px 24px;
}

/* Recent Campaigns List */
.recent-campaigns-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-campaign-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.recent-campaign-item:hover {
    background: rgba(37, 211, 102, 0.08);
}

.campaign-info {
    flex: 1;
    min-width: 0;
}

.campaign-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.campaign-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.campaign-stats-mini {
    display: flex;
    gap: 16px;
}

.stat-mini {
    text-align: center;
}

.stat-mini-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-mini-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-color);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.qa-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.qa-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Dashboard Charts Row */
.dashboard-charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.chart-card .dashboard-card-body {
    min-height: 200px;
}

/* Delivery Chart */
.delivery-chart-wrapper {
    padding: 8px 0;
}

.delivery-bars {
    margin-bottom: 24px;
}

.delivery-bar-item {
    margin-bottom: 16px;
}

.delivery-bar-item:last-child {
    margin-bottom: 0;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.bar-track {
    height: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease;
}

.bar-fill.delivered {
    background: linear-gradient(90deg, #25D366 0%, #1ebe5d 100%);
}

.bar-fill.read {
    background: linear-gradient(90deg, #128c7e 0%, #0d6e63 100%);
}

.delivery-summary {
    display: flex;
    justify-content: space-around;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.summary-item {
    text-align: center;
}

.summary-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Campaign Comparison Chart */
.campaign-comparison-chart {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.comparison-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    flex: 1;
    min-height: 150px;
    padding-bottom: 8px;
}

.comparison-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 60px;
}

.comparison-bar {
    width: 40px;
    background: linear-gradient(180deg, #25D366 0%, #128c7e 100%);
    border-radius: 6px 6px 0 0;
    min-height: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    transition: height 1s ease;
}

.comparison-bar .bar-value {
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.comparison-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comparison-legend {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

/* Empty States */
.empty-state-small {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

.empty-state-small p {
    margin-bottom: 12px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Responsive Dashboard */
@media (max-width: 1200px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .dashboard-content-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .dashboard-stat-card {
        padding: 16px;
    }
    
    .dashboard-stat-card .stat-value {
        font-size: 24px;
    }
    
    .stat-icon-wrapper {
        width: 44px;
        height: 44px;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ==================== HISTORY PAGE FIXES ==================== */

/* Wider filter groups */
.filter-group-wide {
    flex: 2;
    min-width: 250px;
}

.filter-group-narrow {
    flex: 0.5;
    min-width: 100px;
}

.form-control-wide {
    min-width: 280px;
}

/* Empty analytics state */
.empty-analytics {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 150px;
    color: var(--text-muted);
}

.empty-analytics .empty-icon-small {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-analytics p {
    font-size: 14px;
    margin: 0;
}

/* Loading placeholder */
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Delete campaign card - ensure it's styled correctly */
.delete-campaign-card {
    margin-top: 24px;
    border: 2px solid rgba(244, 67, 54, 0.3);
    background: rgba(244, 67, 54, 0.02);
}

.delete-campaign-card .card-header {
    background: rgba(244, 67, 54, 0.05);
}

.delete-campaign-card .card-title {
    color: #d32f2f;
}

.delete-warning {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.delete-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.delete-select {
    flex: 1;
}

.delete-select label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.delete-select select {
    min-width: 300px;
}

/* Filter row layout fix */
.filter-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

/* Empty state in messages */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Responsive for delete section */
@media (max-width: 768px) {
    .delete-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .delete-select select {
        min-width: 100%;
    }
    
    .filter-group-wide {
        flex: 1;
        min-width: 100%;
    }
}
