/* =====================================================
   ChatFlow AI Pro v3 - Ultra Professional Design
   ===================================================== */

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* CSS Variables */
:root {
    /* Brand Colors */
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #34eb7a;
    --primary-rgb: 37, 211, 102;
    
    /* Accent Colors */
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;
    --accent-cyan: #06b6d4;
    
    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Dark Theme */
    --bg-dark: #0c0c10;
    --bg-darker: #08080a;
    --bg-card: rgba(18, 18, 24, 0.95);
    --bg-card-hover: rgba(25, 25, 35, 0.98);
    --bg-input: rgba(30, 30, 42, 0.9);
    --bg-sidebar: linear-gradient(180deg, #0f0f15 0%, #0a0a0e 100%);
    
    --text-white: #ffffff;
    --text-light: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    
    --border-color: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    --gradient-pink: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    --gradient-orange: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(37, 211, 102, 0.15);
    
    /* Sizing */
    --sidebar-width: 280px;
    --header-height: 72px;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    
    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.3s var(--ease);
}

/* Light Theme */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-darker: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --bg-input: rgba(241, 245, 249, 0.9);
    --bg-sidebar: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    
    --text-white: #0f172a;
    --text-light: #1e293b;
    --text-muted: #64748b;
    --text-dark: #94a3b8;
    
    --border-color: rgba(0, 0, 0, 0.06);
    --border-light: rgba(0, 0, 0, 0.1);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.15);
}

/* =====================================================
   Reset & Base
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* =====================================================
   App Layout
   ===================================================== */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-darker);
}

/* =====================================================
   SIDEBAR - Professional Design
   ===================================================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform var(--transition);
}

/* Sidebar Glow Effect */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: radial-gradient(ellipse at top left, rgba(var(--primary-rgb), 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* Sidebar Header */
.sidebar-header {
    padding: 28px 24px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-logo-icon {
    width: 52px;
    height: 52px;
    background: var(--gradient-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
    box-shadow: 0 8px 32px rgba(var(--primary-rgb), 0.4);
    position: relative;
}

.sidebar-logo-icon::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 18px;
    background: var(--gradient-primary);
    opacity: 0.3;
    filter: blur(8px);
    z-index: -1;
}

.sidebar-logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-white) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
}

.sidebar-section {
    margin-bottom: 28px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dark);
    padding: 0 16px 12px;
    font-weight: 600;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav-item {
    margin: 4px 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.sidebar-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    transition: var(--transition);
}

.sidebar-nav-link:hover {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--text-white);
    transform: translateX(4px);
}

.sidebar-nav-link.active {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
}

.sidebar-nav-link.active::before {
    height: 60%;
}

.sidebar-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.sidebar-nav-link:hover i {
    transform: scale(1.15);
    color: var(--primary);
}

.sidebar-nav-badge {
    margin-left: auto;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.sidebar-user:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.sidebar-user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-white);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-dark);
    display: block;
}

.sidebar-logout {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    transform: scale(1.05);
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-dark);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    backdrop-filter: blur(20px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(var(--primary-rgb), 0.1);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    border-color: rgba(var(--primary-rgb), 0.3);
    transform: rotate(20deg) scale(1.05);
}

/* WhatsApp Status Badge */
.whatsapp-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.whatsapp-badge.connected {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
}

.whatsapp-badge.disconnected {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.whatsapp-badge.connected .status-dot {
    background: var(--primary);
    box-shadow: 0 0 16px var(--primary);
}

.whatsapp-badge.disconnected .status-dot {
    background: var(--danger);
    box-shadow: 0 0 16px var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* =====================================================
   CONTENT AREA
   ===================================================== */
.content-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px;
    min-height: 0;
}

/* =====================================================
   STATS CARDS - Pro Design
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.05) 0%, transparent 70%);
    transform: translate(50%, -50%);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    position: relative;
    flex-shrink: 0;
}

.stat-icon.blue { 
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%); 
    color: var(--accent-blue); 
}
.stat-icon.green { 
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%); 
    color: var(--success); 
}
.stat-icon.primary { 
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15) 0%, rgba(var(--primary-rgb), 0.05) 100%); 
    color: var(--primary); 
}
.stat-icon.yellow { 
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%); 
    color: var(--warning); 
}
.stat-icon.purple { 
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%); 
    color: var(--accent-purple); 
}
.stat-icon.red { 
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%); 
    color: var(--danger); 
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.2;
    letter-spacing: -1px;
}

.stat-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
    font-weight: 500;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.card-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(var(--primary-rgb), 0.02);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-title i {
    color: var(--primary);
    font-size: 1rem;
}

.card-body {
    padding: 28px;
}

/* =====================================================
   QUICK STATS (Dashboard)
   ===================================================== */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.mb-30 { margin-bottom: 30px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* =====================================================
   CONVERSATIONS
   ===================================================== */
.conversations-container {
    display: flex;
    height: calc(100vh - var(--header-height) - 64px);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.conv-list {
    width: 380px;
    min-width: 380px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.conv-list-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.conv-search {
    position: relative;
}

.conv-search input {
    width: 100%;
    padding: 14px 20px 14px 52px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-white);
    font-size: 0.95rem;
    transition: var(--transition);
}

.conv-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

.conv-search i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dark);
}

.conv-list-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.conv-item {
    display: flex;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.conv-item:hover {
    background: rgba(var(--primary-rgb), 0.06);
}

.conv-item.active {
    background: rgba(var(--primary-rgb), 0.1);
    border-left: 4px solid var(--primary);
}

.conv-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
}

.conv-info {
    flex: 1;
    min-width: 0;
}

.conv-name {
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 6px;
    font-size: 1rem;
}

.conv-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.conv-time {
    font-size: 0.75rem;
    color: var(--text-dark);
}

.conv-unread {
    width: 26px;
    height: 26px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    background: var(--bg-darker);
}

.chat-header {
    padding: 18px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.message {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 20px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.message.inbound {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.message.outbound {
    background: var(--gradient-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.3);
}

.message-time {
    font-size: 0.7rem;
    margin-top: 8px;
    opacity: 0.7;
}

.chat-input-container {
    padding: 24px 28px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 14px;
    align-items: center;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 16px 24px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-white);
    font-size: 0.95rem;
    transition: var(--transition);
}

.chat-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

.chat-input-wrapper button {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
}

.chat-input-wrapper button:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(var(--primary-rgb), 0.5);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 60px;
}

.empty-state i {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: 0.2;
}

.empty-state h3 {
    font-size: 1.4rem;
    color: var(--text-white);
    margin-bottom: 12px;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-white);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-white);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

.form-control::placeholder {
    color: var(--text-dark);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(var(--primary-rgb), 0.45);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-white);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.3);
}

.btn-sm {
    padding: 10px 18px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

/* =====================================================
   TABLES
   ===================================================== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 18px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dark);
    background: rgba(var(--primary-rgb), 0.03);
}

.table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.04);
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { 
    background: rgba(16, 185, 129, 0.15); 
    color: var(--success); 
}
.badge-warning { 
    background: rgba(245, 158, 11, 0.15); 
    color: var(--warning); 
}
.badge-danger { 
    background: rgba(239, 68, 68, 0.15); 
    color: var(--danger); 
}
.badge-info { 
    background: rgba(59, 130, 246, 0.15); 
    color: var(--info); 
}
.badge-primary { 
    background: rgba(var(--primary-rgb), 0.15); 
    color: var(--primary); 
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 18px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
}

.alert-success { 
    background: rgba(16, 185, 129, 0.12); 
    color: var(--success); 
    border: 1px solid rgba(16, 185, 129, 0.2); 
}
.alert-danger { 
    background: rgba(239, 68, 68, 0.12); 
    color: var(--danger); 
    border: 1px solid rgba(239, 68, 68, 0.2); 
}
.alert-warning { 
    background: rgba(245, 158, 11, 0.12); 
    color: var(--warning); 
    border: 1px solid rgba(245, 158, 11, 0.2); 
}
.alert-info { 
    background: rgba(59, 130, 246, 0.12); 
    color: var(--info); 
    border: 1px solid rgba(59, 130, 246, 0.2); 
}

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 14px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1400px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .stats-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .conv-list { width: 100%; min-width: 100%; }
    .content-container { padding: 20px; }
}