/* ============ CSS Variables ============ */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --danger-color: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.4);
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ============ Layout ============ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============ Sidebar ============ */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition-smooth);
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform var(--transition-smooth);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 28px;
}

.nav-item:hover::before {
    transform: scaleY(1);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item.active::before {
    transform: scaleY(0);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* ============ Main Content ============ */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    overflow-x: hidden;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

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

.view-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

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

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after {
    opacity: 1;
}

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

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
    transform: translateY(-1px);
}

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

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 14px var(--success-glow);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 14px var(--danger-glow);
    transform: translateY(-1px);
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

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

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-smooth);
    cursor: default;
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    transition: var(--transition-smooth);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

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

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============ Recent Section ============ */
.recent-section h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

/* ============ Message List ============ */
.message-list {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
}

.message-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition-fast);
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
}

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

.message-item:last-child {
    border-bottom: none;
}

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

.message-phone {
    font-weight: 600;
    margin-bottom: 4px;
}

.message-body {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.message-meta {
    text-align: right;
    flex-shrink: 0;
}

.message-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.message-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
}

.status-sent { background: #dbeafe; color: #1d4ed8; }
.status-delivered { background: #d1fae5; color: #047857; }
.status-failed { background: #fee2e2; color: #b91c1c; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-received { background: #e0e7ff; color: #4338ca; }

/* ============ Conversations ============ */
.conversations-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 0;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    height: calc(100vh - 150px);
    overflow: hidden;
}

.conversation-list {
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.conversation-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.conversation-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform var(--transition-smooth);
}

.conversation-item:hover {
    background: var(--bg-color);
    padding-left: 24px;
}

.conversation-item:hover::before {
    transform: scaleY(1);
}

.conversation-item.active {
    background: #eef2ff;
    border-left: 3px solid var(--primary-color);
    padding-left: 17px;
}

.conversation-item.active::before {
    transform: scaleY(0);
}

.conversation-contact {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conversation-contact .contact-name {
    font-weight: 600;
}

.conversation-contact .contact-phone {
    font-weight: normal;
}

.conversation-contact .contact-phone.small {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

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

.conversation-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    float: right;
}

.conversation-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.conversation-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    background: var(--bg-color);
}

.conversation-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: bubbleIn 0.3s ease-out;
}

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

.chat-bubble.outbound {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-bubble.inbound {
    background: var(--border-color);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 4px;
}

.conversation-reply {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    background: var(--bg-color);
    flex-shrink: 0;
}

.conversation-reply textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.conversation-reply textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ============ Data Table ============ */
.contacts-table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.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: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-color);
}

.data-table td:last-child {
    text-align: right;
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

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

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

.char-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
    display: block;
    margin-top: 4px;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.recipient-options {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

/* ============ Compose Form ============ */
.compose-form {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    max-width: 700px;
}

.form-actions {
    margin-top: 24px;
}

/* ============ Contact Chips ============ */
.selected-contacts-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 44px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
}

.selected-contacts-chips .no-contacts-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.contact-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    animation: chipIn 0.2s ease-out;
}

@keyframes chipIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.contact-chip .chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 10px;
}

.contact-chip .chip-remove:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ============ Contact Picker Modal ============ */
.contact-picker-filters {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.contact-picker-search {
    position: relative;
    margin-bottom: 12px;
}

.contact-picker-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.contact-picker-search input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.contact-picker-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.contact-picker-filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.contact-picker-filter-row select {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

/* Mobile Only Toggle */
.contact-picker-mobile-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: var(--transition-fast);
}

.contact-picker-mobile-toggle:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
}

.contact-picker-mobile-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.contact-picker-mobile-toggle input[type="checkbox"]:checked + span {
    color: var(--primary-color);
    font-weight: 500;
}

/* Filtered Count Display */
.contact-picker-filtered-count {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #eef2ff 0%, #e8f4fd 100%);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.contact-picker-filtered-count i {
    color: var(--primary-color);
}

.contact-picker-filtered-count span strong {
    color: var(--primary-color);
    font-weight: 600;
}

.contact-picker-list {
    max-height: 350px;
    overflow-y: auto;
}

.contact-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.contact-picker-item.selected {
    background: #eef2ff;
}

.contact-picker-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.contact-picker-item-info {
    flex: 1;
    min-width: 0;
}

.contact-picker-item-name {
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-picker-item-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.contact-picker-item-phone {
    font-family: monospace;
}

.contact-picker-item-role {
    background: var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.contact-picker-item-borough {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.contact-picker-summary {
    padding: 12px 16px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-secondary);
}

/* Empty state for picker */
.contact-picker-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.contact-picker-empty i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ============ Scheduled List ============ */
.scheduled-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.scheduled-item {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.scheduled-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.scheduled-info h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.scheduled-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.scheduled-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.scheduled-status.pending { background: #fef3c7; color: #b45309; }
.scheduled-status.completed { background: #d1fae5; color: #047857; }
.scheduled-status.cancelled { background: #fee2e2; color: #b91c1c; }
.scheduled-status.paused { background: #e0e7ff; color: #4338ca; }
.scheduled-status.failed { background: #fee2e2; color: #b91c1c; }

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

.template-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition-smooth);
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.template-card h4 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.template-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

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

.template-preview {
    white-space: pre-wrap;
    word-break: break-word;
}

.template-var {
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    color: #3730a3;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9em;
}

/* ============ Modal ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-smooth);
}

.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

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

.modal-header h3 {
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

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

/* ============ Toast ============ */\n.toast {\n    position: fixed;\n    bottom: 24px;\n    right: 24px;\n    padding: 16px 24px;\n    background: var(--text-primary);\n    color: white;\n    border-radius: var(--radius);\n    box-shadow: var(--shadow-lg);\n    transform: translateY(100px) scale(0.9);\n    opacity: 0;\n    transition: var(--transition-smooth);\n    z-index: 2000;\n}\n\n.toast.show {\n    transform: translateY(0) scale(1);\n    opacity: 1;\n    animation: toastSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n\n@keyframes toastSlide {\n    0% {\n        transform: translateY(100px) scale(0.9);\n        opacity: 0;\n    }\n    100% {\n        transform: translateY(0) scale(1);\n        opacity: 1;\n    }\n}\n\n.toast.success { background: var(--success-color); }\n.toast.error { background: var(--danger-color); }

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-header h1 span,
    .nav-item span {
        display: none;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .conversations-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .view-actions {
        flex-wrap: wrap;
    }
}

/* ============ Contact Tabs ============ */
.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition-smooth);
    transform: translateX(-50%);
}

.tab-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.tab-btn:hover::before {
    width: 60%;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.tab-btn.active::before {
    width: 0;
}

/* Badge for manual contacts */
.badge-manual {
    background: #8b5cf6;
    color: white;
}

/* ============ Skeleton Loading ============ */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--border-color) 25%,
        #f1f5f9 50%,
        var(--border-color) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text:last-child {
    margin-bottom: 0;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.long {
    width: 90%;
}

/* Skeleton Stat Card */
.skeleton-stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.skeleton-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
}

.skeleton-stat-info {
    flex: 1;
}

.skeleton-stat-value {
    height: 28px;
    width: 60px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-stat-label {
    height: 14px;
    width: 100px;
    border-radius: 4px;
}

/* Skeleton Message Item */
.skeleton-message-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.skeleton-message-info {
    flex: 1;
}

.skeleton-message-phone {
    height: 16px;
    width: 120px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-message-body {
    height: 14px;
    width: 80%;
    border-radius: 4px;
}

.skeleton-message-meta {
    text-align: right;
}

.skeleton-message-time {
    height: 12px;
    width: 60px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-message-status {
    height: 20px;
    width: 70px;
    border-radius: 4px;
}

/* Skeleton Conversation Item */
.skeleton-conversation-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-conversation-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.skeleton-conversation-name {
    height: 16px;
    width: 140px;
    border-radius: 4px;
}

.skeleton-conversation-time {
    height: 12px;
    width: 50px;
    border-radius: 4px;
}

.skeleton-conversation-preview {
    height: 14px;
    width: 90%;
    border-radius: 4px;
}

/* Skeleton Table Row */
.skeleton-table-row td {
    padding: 14px 16px;
}

.skeleton-table-cell {
    height: 16px;
    border-radius: 4px;
}

/* Skeleton Template Card */
.skeleton-template-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.skeleton-template-title {
    height: 18px;
    width: 50%;
    margin-bottom: 12px;
    border-radius: 4px;
}

.skeleton-template-body {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-template-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.skeleton-template-btn {
    height: 32px;
    width: 60px;
    border-radius: var(--radius);
}

/* Skeleton Scheduled Item */
.skeleton-scheduled-item {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-scheduled-info {
    flex: 1;
}

.skeleton-scheduled-title {
    height: 18px;
    width: 200px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.skeleton-scheduled-detail {
    height: 14px;
    width: 150px;
    margin-bottom: 6px;
    border-radius: 4px;
}

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

.skeleton-scheduled-btn {
    height: 36px;
    width: 80px;
    border-radius: var(--radius);
}

/* Skeleton Contact Picker */
.skeleton-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-picker-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

.skeleton-picker-info {
    flex: 1;
}

.skeleton-picker-name {
    height: 16px;
    width: 140px;
    margin-bottom: 6px;
    border-radius: 4px;
}

.skeleton-picker-details {
    display: flex;
    gap: 12px;
}

.skeleton-picker-phone {
    height: 12px;
    width: 100px;
    border-radius: 4px;
}

.skeleton-picker-role {
    height: 12px;
    width: 60px;
    border-radius: 4px;
}