/* ===============================================
   WhatsApp API Gateway — Premium Dark Dashboard
   =============================================== */

:root {
    --bg-primary: #0a0f1c;
    --bg-secondary: #111827;
    --bg-card: #1a2236;
    --bg-card-hover: #1f2a42;
    --bg-input: #0d1425;
    --border: #2a3550;
    --border-light: #1e2a40;
    --text-primary: #e8ecf4;
    --text-secondary: #8b95aa;
    --text-muted: #5a6478;
    --wa-green: #25D366;
    --wa-green-dark: #1da851;
    --wa-green-glow: rgba(37, 211, 102, 0.15);
    --wa-teal: #128C7E;
    --accent-blue: #3b82f6;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 30px rgba(37, 211, 102, 0.08);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =============== LOGIN =============== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(37, 211, 102, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow), var(--shadow-glow);
    animation: fadeInUp 0.6s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--wa-green), var(--wa-teal));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.25);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--wa-green);
    box-shadow: 0 0 0 3px var(--wa-green-glow);
}

.error-text {
    color: var(--accent-red);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
}
.setup-notice {
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid var(--wa-green);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--wa-green);
    text-align: center;
}
.setup-notice i {
    margin-right: 6px;
}
.user-badge {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 0;
    text-align: center;
}

/* =============== BUTTONS =============== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--wa-green), var(--wa-green-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.4);
}

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

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
}
.btn-danger:hover { opacity: 0.9; }

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

.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-icon { background: transparent; color: var(--text-secondary); padding: 8px; border: none; }
.btn-icon:hover { color: var(--text-primary); }

.mb-2 { margin-bottom: 10px; }
.mt-3 { margin-top: 20px; }

/* =============== DASHBOARD LAYOUT =============== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.logo-sm {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--wa-green), var(--wa-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

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

.nav-item.active {
    background: var(--wa-green-glow);
    color: var(--wa-green);
}

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

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.connection-badge {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.connection-badge.connected {
    background: rgba(37, 211, 102, 0.1);
    color: var(--wa-green);
}
.connection-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}
.connection-badge.connecting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.connection-badge.connected .status-dot {
    animation: pulse 2s infinite;
}

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

.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.topbar h2 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.instance-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
}

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

.instance-selector select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 12px;
    font-size: 13px;
    min-width: 150px;
}

.instance-selector select:focus {
    outline: none;
    border-color: var(--wa-green);
}

.sidebar-toggle { display: none; }

.account-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 13px;
}

#account-name { font-weight: 600; }
#account-phone { color: var(--text-muted); font-size: 11px; }

/* Pages */
.page {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}
.page.active { display: block; }

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

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

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

.stat-icon.green { background: rgba(37, 211, 102, 0.12); color: var(--wa-green); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.12); color: var(--accent-orange); }
.stat-icon.red { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

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

/* =============== CARDS =============== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--wa-green); font-size: 14px; }

.card-body {
    padding: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: var(--text-secondary); }

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-green { background: rgba(37, 211, 102, 0.12); color: var(--wa-green); }
.badge-red { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); }
.badge-orange { background: rgba(245, 158, 11, 0.12); color: var(--accent-orange); }
.badge-blue { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.badge-gray { background: rgba(107, 114, 128, 0.12); color: var(--text-secondary); }

/* =============== QR =============== */
.qr-container { max-width: 600px; margin: 0 auto; }

.qr-card .qr-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-display {
    width: 300px;
    height: 300px;
    background: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    overflow: hidden;
}

.qr-display img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

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

.qr-placeholder i { font-size: 32px; margin-bottom: 12px; }

.qr-instructions {
    width: 100%;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.qr-instructions h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--wa-green);
}

.qr-instructions ol {
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.qr-instructions li { margin-bottom: 8px; }

/* =============== FORMS =============== */
.form-group { margin-bottom: 16px; }

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--wa-green);
    box-shadow: 0 0 0 3px var(--wa-green-glow);
}

.form-input-sm {
    width: 180px;
    padding: 8px 12px;
    font-size: 13px;
}

textarea.form-input { resize: vertical; line-height: 1.5; }

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-with-copy {
    display: flex;
    gap: 8px;
}
.input-with-copy .form-input { flex: 1; }

/* Tabs */
.send-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--wa-green);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Source Toggle */
.source-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--border-color);
}
.toggle-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}
.toggle-btn.active {
    background: var(--wa-green);
    color: #fff;
}
.toggle-btn:hover:not(.active) {
    background: var(--hover-bg);
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.file-drop-zone i {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
    color: var(--wa-green);
}
.file-drop-zone p {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}
.file-drop-zone .file-drop-hint {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}
.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--wa-green);
    background: rgba(37, 211, 102, 0.05);
}

/* File Preview */
.file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
}
.file-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}
.file-preview .file-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hover-bg);
    border-radius: 6px;
    font-size: 20px;
    color: var(--wa-green);
}
.file-preview .file-info {
    flex: 1;
    min-width: 0;
}
.file-preview .file-info .name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-preview .file-info .size {
    font-size: 11px;
    color: var(--text-secondary);
}
.file-preview .file-remove {
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 4px;
}
.file-preview .file-remove:hover {
    background: rgba(239,83,80,0.1);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    transition: var(--transition);
}
.slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}
.switch input:checked + .slider { background: var(--wa-green); }
.switch input:checked + .slider::before { transform: translateX(22px); }

.switch-sm { width: 36px; height: 20px; }
.switch-sm .slider::before { width: 14px; height: 14px; }
.switch-sm input:checked + .slider::before { transform: translateX(16px); }

/* Chatbot Rules */
.chatbot-rule {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: all 0.2s;
}
.chatbot-rule.disabled {
    opacity: 0.5;
}
.chatbot-rule:hover {
    border-color: var(--wa-green);
}
.rule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.rule-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.rule-trigger code {
    background: var(--hover-bg);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rule-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.rule-response {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 10px;
    background: var(--hover-bg);
    border-radius: 6px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}
.rule-response i {
    color: var(--wa-green);
    margin-right: 6px;
}
.rule-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}
.rule-meta i {
    margin-right: 4px;
}

/* Result box */
.result-box {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    white-space: pre-wrap;
}
.result-box.success { background: rgba(37, 211, 102, 0.1); color: var(--wa-green); border: 1px solid rgba(37, 211, 102, 0.2); }
.result-box.error { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }

/* =============== TABLE =============== */
.table-container { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-input);
}

.data-table td { color: var(--text-secondary); }

.data-table tr:hover td { background: var(--bg-card-hover); }

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

.msg-direction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}
.msg-direction.out { color: var(--wa-green); }
.msg-direction.in { color: var(--accent-blue); }

.msg-body-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============== CONTACTS / GROUPS LIST =============== */
.contacts-list {
    max-height: 500px;
    overflow-y: auto;
}

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

.contact-item:hover { background: var(--bg-card-hover); }
.contact-item:last-child { border-bottom: none; }

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--wa-green);
    flex-shrink: 0;
}

.contact-info { flex: 1; min-width: 0; }
.contact-info .name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.contact-info .phone {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-action {
    background: none;
    border: 1px solid var(--border);
    color: var(--wa-green);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
}

.contact-action:hover {
    background: var(--wa-green);
    color: white;
    border-color: var(--wa-green);
}

/* =============== API DOCS =============== */
.api-docs-body h4 {
    font-size: 16px;
    margin: 24px 0 12px 0;
    color: var(--wa-green);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.api-docs-body h4:first-child { margin-top: 0; }

.api-docs-body p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.api-docs-body pre {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.api-docs-body code {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
}

.api-endpoint {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-input);
}

.api-endpoint > code {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.api-endpoint > p {
    margin-top: 6px;
    margin-bottom: 8px;
}

.method {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
    vertical-align: middle;
}

.method.get { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.method.post { background: rgba(37, 211, 102, 0.15); color: var(--wa-green); }
.method.delete { background: rgba(231, 76, 60, 0.15); color: var(--danger); }
.method.put { background: rgba(241, 196, 15, 0.15); color: #f1c40f; }

.api-section { margin-bottom: 32px; }
.api-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 28px 0 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.api-section-title:first-child { margin-top: 0; }
.api-section-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.api-endpoint .params { margin-top: 8px; }
.api-endpoint .params table { width: 100%; font-size: 12px; border-collapse: collapse; }
.api-endpoint .params th { text-align: left; padding: 4px 8px; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border); font-size: 10px; text-transform: uppercase; }
.api-endpoint .params td { padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.api-endpoint .params td code { font-size: 11px; }
.param-required { color: var(--danger); font-size: 10px; font-weight: 600; }
.param-optional { color: var(--text-secondary); font-size: 10px; }

.api-base-url {
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.api-base-url code {
    font-size: 14px;
    color: var(--wa-green);
    word-break: break-all;
}

/* =============== TOAST =============== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success { background: var(--wa-green); color: white; }
.toast.error { background: var(--accent-red); color: white; }
.toast.info { background: var(--accent-blue); color: white; }

/* =============== ANIMATIONS =============== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

/* =============== MODAL =============== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.3s ease;
}

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

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

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

.modal-body {
    padding: 24px;
}

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

/* =============== INSTANCES =============== */
.instances-list {
    max-height: 500px;
    overflow-y: auto;
}

.instance-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    background: var(--bg-card);
    transition: var(--transition);
}

.instance-item:hover {
    border-color: var(--wa-green);
    box-shadow: var(--shadow-glow);
}

.instance-info {
    flex: 1;
}

.instance-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.instance-id-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.instance-id-label code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.instance-status {
    font-size: 12px;
}

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

/* =============== RESPONSIVE =============== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .form-group-row { grid-template-columns: 1fr; }
    .send-tabs { flex-wrap: wrap; }
    .tab-btn { flex: none; width: calc(50% - 2px); }
    .qr-display { width: 250px; height: 250px; }
    .form-input-sm { width: 120px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page { padding: 16px; }
    .login-card { padding: 32px 24px; }
}

/* =============== POLL =============== */
.poll-option-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.poll-option-row .form-input { flex: 1; }
.poll-option-row .btn-danger { flex-shrink: 0; }

/* =============== BULK MESSAGING =============== */
.bulk-search-box { margin-bottom: 8px; }
.bulk-select-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.bulk-recipient-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    background: var(--bg-primary);
}
.bulk-recipient-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
}
.bulk-recipient-item:hover { background: var(--bg-tertiary); }
.bulk-recipient-item input[type="checkbox"] { flex-shrink: 0; }
.bulk-recipient-item small { color: var(--text-secondary); margin-left: auto; }
.bulk-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 8px 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.bulk-job-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--bg-secondary);
}
.bulk-job-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.bulk-job-header small { margin-left: auto; color: var(--text-secondary); }

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(46,204,113,0.15); color: var(--success); }
.badge-warning { background: rgba(241,196,15,0.15); color: #f1c40f; }
.badge-danger { background: rgba(231,76,60,0.15); color: var(--danger); }
.badge-info { background: rgba(52,152,219,0.15); color: #3498db; }
.badge-secondary { background: rgba(149,165,166,0.15); color: var(--text-secondary); }

/* =============== SCHEDULED MESSAGES =============== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table th { font-weight: 600; color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table tr:hover { background: var(--bg-tertiary); }

/* API usage example */
.api-usage-example {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    overflow-x: auto;
}
.api-usage-example code {
    font-size: 12px;
    color: var(--success);
    word-break: break-all;
}

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