/* ===================================
   WhatsApp Mass Sender - Premium Styles
   =================================== */

:root {
    /* WhatsApp inspired color palette */
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #34B7F1;
    --secondary: #075E54;
    --accent: #DCF8C6;

    /* Dark theme colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(26, 26, 37, 0.8);
    --bg-glass: rgba(26, 26, 37, 0.6);

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;

    /* Status colors */
    --success: #25D366;
    --warning: #FFA500;
    --danger: #FF4444;
    --info: #34B7F1;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    --gradient-accent: linear-gradient(135deg, #34B7F1 0%, #25D366 100%);
    --gradient-dark: linear-gradient(135deg, #1a1a25 0%, #0a0a0f 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(37, 211, 102, 0.3);

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Spacing */
    --sidebar-width: 260px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

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

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

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--primary);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.nav-menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

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

.nav-item:hover {
    background: rgba(37, 211, 102, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(37, 211, 102, 0.15);
    color: var(--primary);
}

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

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

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

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.disconnected {
    background: var(--danger);
    animation: none;
}

.status-dot.connecting {
    background: var(--warning);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 32px;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(20px);
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: rgba(37, 211, 102, 0.2);
    box-shadow: var(--shadow-md);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h3 svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

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

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

/* Connection Section */
.connection-card {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    padding: 40px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
}

.qr-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    aspect-ratio: 1;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.qr-placeholder svg {
    width: 80px;
    height: 80px;
    color: #ccc;
    margin-bottom: 16px;
}

.qr-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.qr-image.hidden {
    display: none;
}

.connection-info h3 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.connection-steps {
    padding-left: 24px;
    margin-bottom: 32px;
}

.connection-steps li {
    margin-bottom: 12px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.connection-steps strong {
    color: var(--text-primary);
}

.connection-actions {
    display: flex;
    gap: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(255, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.3);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.05rem;
}

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

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

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-normal);
}

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

textarea {
    resize: vertical;
    min-height: 120px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

small {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Contacts Section */
.contacts-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
}

.import-card {
    height: fit-content;
}

.import-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.file-upload input {
    display: none;
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

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

.upload-area svg {
    width: 40px;
    height: 40px;
    color: var(--primary);
    margin-bottom: 12px;
}

.upload-area span {
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.import-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(37, 211, 102, 0.1);
    border-radius: var(--radius-md);
    margin-top: 16px;
}

.import-status .status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.import-status .status-icon.success {
    background: var(--success);
}

.import-status .status-icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

/* Contacts Table */
.contacts-list-card {
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.contacts-table-wrapper {
    flex: 1;
    overflow: auto;
}

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

.contacts-table th,
.contacts-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.contacts-table th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
}

.contacts-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.contacts-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.contact-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state svg {
    width: 60px;
    height: 60px;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

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

/* Messages Section */
.messages-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

.message-editor-card {
    min-height: 500px;
}

.editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
}

.toolbar-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.toolbar-divider {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 8px;
}

.message-editor-card textarea {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    min-height: 200px;
}

.char-count {
    text-align: right;
    color: var(--text-muted);
}

/* WhatsApp Preview Container */
.whatsapp-preview-container {
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAKElEQVQoU2NkIBIwEqmOgXSFjDDFMIWjeNAqYiCFY+hAoB0KhS0AAGy0AOl+7NKAAAAASUVORK5CYII=');
    background-color: #0b141a;
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.whatsapp-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-contact-name {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.preview-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.message-preview {
    background: #005c4b;
    color: #e9edef;
    padding: 12px 16px;
    border-radius: 8px 8px 0 8px;
    min-height: 60px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 85%;
    margin-left: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.message-preview::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    width: 0;
    height: 0;
    border-left: 8px solid #005c4b;
    border-top: 8px solid transparent;
}

.message-preview strong {
    font-weight: 700;
}

.message-preview em {
    font-style: italic;
}

.message-preview .variable-tag {
    background: rgba(37, 211, 102, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.preview-placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* AI Variations */
.variation-levels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.variation-option {
    cursor: pointer;
}

.variation-option input {
    display: none;
}

.option-card {
    display: block;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.variation-option input:checked+.option-card {
    border-color: var(--primary);
    background: rgba(37, 211, 102, 0.1);
}

.option-card strong {
    display: block;
    margin-bottom: 4px;
}

.option-card small {
    color: var(--text-muted);
    margin: 0;
}

.variations-list {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.variations-list h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.variations-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.variation-item {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.variation-item:hover {
    background: rgba(37, 211, 102, 0.1);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* AI Info/Status */
.ai-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(37, 211, 102, 0.1);
    border-radius: var(--radius-md);
    color: var(--success);
    font-size: 0.85rem;
}

/* Campaigns Section */
.campaign-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.delay-config {
    display: flex;
    gap: 12px;
}

.delay-config input {
    width: 100px;
}

.delay-config select {
    flex: 1;
}

.selected-contacts-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.selected-contacts-summary .count {
    font-weight: 700;
    color: var(--primary);
}

.campaign-message {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    min-height: 100px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

/* Progress */
.progress-container {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.progress-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.progress-stats .stat {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 24px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width var(--transition-normal);
    width: 0%;
}

.progress-log {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
}

.log-entry {
    padding: 4px 0;
    display: flex;
    gap: 8px;
}

.log-entry.success {
    color: var(--success);
}

.log-entry.failed {
    color: var(--danger);
}

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

/* Reports Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all var(--transition-normal);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-icon.contacts {
    background: rgba(52, 183, 241, 0.15);
    color: var(--info);
}

.stat-icon.campaigns {
    background: rgba(37, 211, 102, 0.15);
    color: var(--primary);
}

.stat-icon.sent {
    background: rgba(37, 211, 102, 0.15);
    color: var(--success);
}

.stat-icon.failed {
    background: rgba(255, 68, 68, 0.15);
    color: var(--danger);
}

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

.stat-info .stat-label {
    font-size: 0.85rem;
}

/* Campaigns Table */
.campaigns-table {
    width: 100%;
    border-collapse: collapse;
}

.campaigns-table th,
.campaigns-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.campaigns-table th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

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

.status-badge.running {
    background: rgba(255, 165, 0, 0.15);
    color: var(--warning);
}

.status-badge.failed {
    background: rgba(255, 68, 68, 0.15);
    color: var(--danger);
}

.status-badge.stopped {
    background: rgba(100, 100, 100, 0.15);
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.modal-lg {
    max-width: 700px;
}

@keyframes slideUp {
    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 rgba(255, 255, 255, 0.05);
}

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

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.groups-list,
.modal-contacts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.group-item,
.modal-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.group-item:hover,
.modal-contact-item:hover {
    background: rgba(37, 211, 102, 0.1);
}

.modal-contact-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

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

.toast {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.toast.error {
    border-left: 3px solid var(--danger);
}

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

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

.toast-icon {
    width: 24px;
    height: 24px;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info .toast-icon {
    color: var(--info);
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

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

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 1200px) {
    .connection-card {
        grid-template-columns: 1fr;
    }

    .contacts-grid,
    .messages-grid,
    .campaign-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 72px;
    }

    .logo-text,
    .nav-item span,
    .status-text {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 16px;
    }

    .main-content {
        padding: 16px;
    }

    .variation-levels {
        grid-template-columns: 1fr;
    }
}

/* User Info Styles */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar span {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    text-align: left;
    transition: color var(--transition-fast);
}

.btn-logout:hover {
    color: var(--danger);
}

/* AI Toggle Styles */
.ai-toggle {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    flex: 1;
}

.toggle-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toggle-title svg {
    color: var(--primary);
}

.toggle-label small {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.ai-info-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(37, 211, 102, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.ai-info-box svg {
    color: var(--primary);
    flex-shrink: 0;
}

/* Group Search Styles */
.search-box-large {
    display: flex;
    gap: 12px;
}

.search-box-large input {
    flex: 1;
    padding: 14px 16px;
    font-size: 1rem;
}

.group-results-container {
    margin-top: 24px;
}

.group-results {
    display: grid;
    gap: 16px;
}

.group-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
}

.group-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.group-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.group-icon svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.group-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.group-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.group-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.group-source {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.group-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.no-link {
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.loading-groups .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.no-results h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.no-results.error svg {
    color: var(--danger);
}

/* Agent Styles */
.agent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.agent-config-card textarea {
    resize: vertical;
    min-height: 120px;
}

.agent-logs {
    max-height: 400px;
    overflow-y: auto;
}

.agent-log-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.agent-log-item .contact {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.agent-log-item .message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.agent-log-item .response {
    font-size: 0.9rem;
    color: var(--text-primary);
    padding-left: 12px;
    border-left: 2px solid var(--primary);
    margin-top: 8px;
}

.agent-log-item .time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

@media (max-width: 768px) {
    .search-box-large {
        flex-direction: column;
    }

    .group-card {
        flex-direction: column;
    }

    .group-icon {
        width: 48px;
        height: 48px;
    }

    .group-actions {
        flex-direction: row;
        width: 100%;
    }

    .group-actions .btn {
        flex: 1;
    }

    .agent-grid {
        grid-template-columns: 1fr;
    }
}

/* Links Grid Styles */
.links-header {
    margin-bottom: 20px;
}

.links-header h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.links-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.link-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.link-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.link-url {
    color: var(--primary);
    text-decoration: none;
    word-break: break-all;
    font-size: 0.9rem;
}

.link-url:hover {
    text-decoration: underline;
}

.link-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.manual-search-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .link-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .link-actions {
        width: 100%;
    }

    .link-actions .btn {
        flex: 1;
    }
}

/* Advanced Delay Configuration */
.delay-range,
.batch-config {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.delay-range input,
.batch-config input {
    width: 70px;
    text-align: center;
}

.delay-range span,
.batch-config span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Plan Banner Styles */
.plan-banner {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.15) 0%, rgba(255, 100, 0, 0.1) 100%);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
    text-align: center;
}

.plan-banner.premium {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.15) 0%, rgba(18, 140, 126, 0.1) 100%);
    border-color: rgba(37, 211, 102, 0.3);
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffa500;
    margin-bottom: 6px;
}

.plan-badge svg {
    width: 16px;
    height: 16px;
}

.plan-badge.premium {
    color: var(--primary);
}

.plan-limit {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upgrade-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: linear-gradient(135deg, #ffa500 0%, #ff6b00 100%);
    color: #000;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.4);
}

.plan-banner.premium .upgrade-btn {
    display: none;
}