/* ========================================
   Dashboard Styles - WhatsApp API
   ======================================== */

/* ---------- Dashboard Layout ---------- */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: 0;
}

.dashboard-wrapper .navbar {
    display: none;
}

/* ---------- Sidebar ---------- */
.dashboard-sidebar {
    width: 260px;
    min-height: 100vh;
    background: color-mix(in srgb, var(--sidebar-bg, rgba(17, 24, 39, 0.4)) 50%, transparent);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1050;
    transition: transform 0.3s ease, width 0.3s ease, background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease !important;
    overflow: hidden;
}

.dashboard-sidebar::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(var(--accent-rgb, 37, 211, 102), 0.06) 0%, transparent 60%);
    animation: liquidFlowSidebar 18s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes liquidFlowSidebar {
    0% {
        transform: rotate(0deg) translate(-2%, 2%);
    }

    50% {
        transform: rotate(180deg) translate(2%, -2%);
    }

    100% {
        transform: rotate(360deg) translate(-2%, 2%);
    }
}

[data-theme="light"] .dashboard-sidebar {
    background: rgba(255, 255, 255, 0.6);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #000;
    flex-shrink: 0;
}

.user-info h6 {
    margin: 0;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.user-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    margin-right: 4px;
    vertical-align: middle;
}

.status-dot.online {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.status-dot.scanning {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ---------- Sidebar Nav ---------- */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary) !important;
}

.sidebar-link.active {
    background: rgba(37, 211, 102, 0.12);
    color: var(--accent) !important;
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.sidebar-link.text-danger {
    color: #ef4444 !important;
}

.sidebar-link.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    min-width: 22px;
    text-align: center;
}

.sidebar-divider {
    border-color: var(--border-color);
    margin: 0.5rem 0;
}

/* ---------- Appearance Settings Page ---------- */
body,
.dashboard-sidebar,
.dashboard-main,
.panel-card,
.stat-card,
.sidebar-link,
.nav-link,
.btn,
* {
    /* Global smooth transitions for theme switching */
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-card,
.color-theme-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.theme-card:hover,
.color-theme-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.theme-card.active,
.color-theme-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent) inset, 0 10px 30px rgba(0, 0, 0, 0.15);
}

.theme-check,
.color-check {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.2rem;
    color: var(--accent);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-card.active .theme-check,
.color-theme-card.active .color-check {
    opacity: 1;
    transform: scale(1);
}

/* Base Mode Previews */
.theme-card-preview {
    height: 80px;
    border-radius: 6px;
    margin: 0 auto 15px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dark-mode-card .theme-card-preview {
    background-color: #020617;
}

.light-mode-card .theme-card-preview {
    background-color: #f8fafc;
}

.preview-header {
    height: 15px;
    background: rgba(128, 128, 128, 0.1);
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.preview-body {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-line {
    height: 6px;
    background: rgba(128, 128, 128, 0.2);
    border-radius: 3px;
}

.preview-btn {
    height: 12px;
    width: 40px;
    background: var(--accent);
    border-radius: 3px;
    align-self: flex-start;
    margin-top: auto;
}

/* Premium Themes Swatches */
.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 auto 10px;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.theme-midnight .color-swatch {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.theme-forest .color-swatch {
    background: linear-gradient(135deg, #10b981, #059669);
}

.theme-purple .color-swatch {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.theme-sunset .color-swatch {
    background: linear-gradient(135deg, #f97316, #c2410c);
}

/* Custom Maker */
.form-control-color {
    height: 38px;
    width: 60px;
    border-radius: 8px;
    cursor: crosshair;
}

.custom-preview-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.custom-preview-box::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    border-radius: 50%;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* ---------- Mobile Top Bar ---------- */
.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1040;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.mobile-logout {
    color: #ef4444 !important;
    font-size: 1.3rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1045;
}

.sidebar-overlay.open {
    display: block;
}

/* ---------- Main Content ---------- */
.dashboard-main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    background: var(--bg-primary);
    min-height: 100vh;
    transition: margin-left 0.3s ease, padding 0.3s ease, background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease !important;
}

/* ---------- Stats Row ---------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(37, 211, 102, 0.2);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-card-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ---------- Panel Card ---------- */
.tab-content-panel {
    display: none;
}

.tab-content-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.panel-header h5 i {
    color: var(--accent);
    margin-right: 8px;
}

.panel-body {
    padding: 2rem;
}

/* ---------- Connection Badge ---------- */
.connection-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ---------- QR Code Section ---------- */
.qr-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 0;
}

.qr-image-container {
    display: inline-block;
    padding: 1.25rem;
    background: #fff;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(37, 211, 102, 0.15);
}

.qr-real-image {
    display: block;
    width: 256px;
    height: 256px;
    border-radius: 8px;
}

.error-icon {
    width: 100px;
    height: 100px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.qr-container {
    padding: 2rem 0;
}

.qr-disconnected,
.qr-connected,
.qr-scanning {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.disconnected-icon {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.connected-icon {
    width: 100px;
    height: 100px;
    background: rgba(37, 211, 102, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.connected-phone {
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.2);
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    color: var(--accent);
    margin-top: 0.5rem;
}

/* QR Code Placeholder Animation */
.qr-placeholder {
    display: inline-block;
    padding: 1.5rem;
    background: #fff;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.qr-fake {
    position: relative;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    width: 200px;
    height: 200px;
}

.qr-cell {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.qr-cell.filled {
    background: #000;
}

.qr-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
    0% {
        top: 0;
    }

    50% {
        top: 100%;
    }

    100% {
        top: 0;
    }
}

/* ---------- QR Actions ---------- */
.btn-danger-glass {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
    border-radius: 50px !important;
    font-weight: 600;
    padding: 10px 28px;
    transition: var(--transition);
}

.btn-danger-glass:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

/* ---------- Send Message Form ---------- */
.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-label i {
    color: var(--accent);
    margin-right: 4px;
}

#tab-send .form-control {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

#tab-send .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

#tab-send .input-group-text {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ---------- Inbox Styles ---------- */
.inbox-list {
    max-height: 600px;
    overflow-y: auto;
}

.inbox-empty {
    padding: 4rem 2rem;
    text-align: center;
}

.inbox-empty i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
}

.inbox-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    opacity: 1;
    transform: translateY(0);
}

.inbox-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.inbox-item:last-child {
    border-bottom: none;
}

.inbox-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.inbox-avatar.outgoing {
    background: rgba(37, 211, 102, 0.15);
    color: var(--accent);
}

.inbox-avatar.incoming {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.inbox-content {
    flex: 1;
    min-width: 0;
}

.inbox-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.inbox-phone {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.inbox-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.inbox-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.inbox-status {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.inbox-status i {
    margin-right: 2px;
}

.status-sent {
    color: var(--text-muted);
}

.status-delivered {
    color: #3b82f6;
}

.status-read {
    color: var(--accent);
}

.status-failed {
    color: #ef4444;
}

/* Filter buttons animation & styling */
.filter-group {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    padding: 3px;
    border: 1px solid var(--border-color);
}

.filter-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    color: var(--text-secondary);
    border: none;
    border-radius: 50px !important;
    padding: 0.25rem 1rem;
    font-weight: 600;
    font-size: 0.8rem;
    background: transparent;
}

.filter-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
    transform: none;
    background-color: var(--accent) !important;
    color: #000 !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 2;
}

/* ---------- Alert Styles in Dashboard ---------- */
#tab-send .alert-success {
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.3);
    color: var(--accent);
    border-radius: var(--radius-sm);
}

#tab-send .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: var(--radius-sm);
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991.98px) {
    .dashboard-sidebar {
        transform: translateX(-100%);
    }

    .dashboard-sidebar.open {
        transform: translateX(0);
    }

    .dashboard-main {
        margin-left: 0;
        padding-top: 72px;
    }

    .dashboard-wrapper {
        padding-top: 0;
    }
}

@media (max-width: 576px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card-number {
        font-size: 1.2rem;
    }

    .dashboard-main {
        padding: 1rem;
        padding-top: 72px;
    }

    .panel-body {
        padding: 1rem;
    }

    .qr-grid {
        width: 160px;
        height: 160px;
    }
}

/* ---------- API Keys Styles ---------- */
.api-key-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.api-key-item:hover {
    border-color: rgba(37, 211, 102, 0.3);
}

.api-key-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.api-key-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}

.api-key-actions {
    display: flex;
    gap: 6px;
}

.api-key-actions .btn {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.api-key-value {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--accent);
    word-break: break-all;
}

.api-key-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.api-key-meta i {
    margin-right: 4px;
}

.new-key-box {
    margin-bottom: 1.5rem;
}

.new-key-box .alert-success {
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.3);
    color: var(--accent);
}

.api-quickstart {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
}

.copy-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: #000;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    z-index: 9999;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
}

@keyframes toastIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ---------- API Docs Styles ---------- */
.docs-container {
    max-width: 900px;
}

.doc-section {
    margin-bottom: 2rem;
}

.api-version {
    background: rgba(37, 211, 102, 0.15);
    color: var(--accent);
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

.doc-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.doc-info-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    text-align: center;
}

.doc-info-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin: 0 auto 0.75rem;
}

.icon-green {
    background: rgba(37, 211, 102, 0.15);
    color: var(--accent);
}

.icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.icon-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.icon-orange {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.doc-info-card h6 {
    margin: 0 0 4px;
    font-weight: 700;
    font-size: 0.95rem;
}

.doc-info-card p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.doc-base-url {
    margin-top: 1.5rem;
}

.doc-base-url label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    position: relative;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.code-block.code-multi {
    display: block;
    padding: 1rem 1.25rem;
    overflow-x: auto;
}

.code-block.code-multi .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

.code-block pre {
    margin: 0;
    white-space: pre;
    color: #e2e8f0;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.doc-subtitle {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.doc-endpoint {
    background: rgba(37, 211, 102, 0.08);
    border: 1px solid rgba(37, 211, 102, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.method-badge {
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.method-post {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.method-get {
    background: rgba(37, 211, 102, 0.2);
    color: var(--accent);
}

.doc-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
}

.doc-table th {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.doc-table td {
    padding: 10px 14px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.doc-table code {
    background: rgba(37, 211, 102, 0.1);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.82rem;
}

.doc-warning {
    display: flex;
    gap: 12px;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    color: #f97316;
    font-size: 0.88rem;
}

.doc-warning i {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.doc-tip {
    display: flex;
    gap: 12px;
    background: rgba(37, 211, 102, 0.08);
    border: 1px solid rgba(37, 211, 102, 0.2);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    color: var(--accent);
    font-size: 0.88rem;
}

.doc-tip i {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.text-accent {
    color: var(--accent) !important;
}

/* ========================================
   RESPONSIVE MEDIA QUERIES
   ======================================== */

/* ---------- Extra Large (≥1400px) ---------- */
@media (min-width: 1400px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .dashboard-main {
        padding: 2.5rem 3rem;
    }
}

/* ---------- Large Desktop (991px - 1399px) ---------- */
@media (max-width: 1399px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---------- Tablet Portrait (768px - 991px) ---------- */
@media (max-width: 991px) {

    /* Sidebar hidden by default on tablet — use overlay/toggle */
    .dashboard-sidebar {
        transform: translateX(-100%);
        width: 260px !important;
        z-index: 1060;
    }

    .dashboard-sidebar.open {
        transform: translateX(0);
    }

    /* Main takes full width on tablet */
    .dashboard-main,
    .dashboard-main.sidebar-collapsed {
        margin-left: 0 !important;
        padding: 1.5rem;
    }

    /* Show mobile topbar */
    .mobile-topbar {
        display: flex !important;
    }

    /* Push main content below mobile topbar */
    .dashboard-main {
        padding-top: calc(56px + 1.5rem);
    }

    /* Stats: 2 columns on tablet */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
    }

    /* Hide desktop sidebar toggle */
    .sidebar-toggle-btn {
        display: none;
    }

    /* Shrink panel body */
    .panel-body {
        padding: 1.5rem;
    }

    /* Docs grid: 1 column */
    .doc-info-grid {
        grid-template-columns: 1fr;
    }

    /* API key top row */
    .api-key-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Bulk campaign grid */
    .campaign-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ---------- Mobile Landscape / Large Phone (≤767px) ---------- */
@media (max-width: 767px) {

    /* Stats: 2 columns */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card-number {
        font-size: 1.25rem;
    }

    /* Panel */
    .panel-body {
        padding: 1.25rem;
    }

    .panel-header {
        padding: 1rem 1.25rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .panel-header h5 {
        font-size: 1rem;
    }

    /* QR image: scale to fit */
    .qr-real-image {
        width: 220px;
        height: 220px;
    }

    .qr-image-container {
        padding: 1rem;
    }

    /* QR actions: stack buttons */
    .qr-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: center;
        width: 100%;
    }

    .qr-actions .btn {
        width: 100%;
        max-width: 280px;
        margin: 0 !important;
    }

    /* Send form */
    .form-control-lg {
        font-size: 0.9rem !important;
        padding: 0.65rem 0.875rem !important;
    }

    /* Inbox items */
    .inbox-item {
        padding: 0.875rem 1rem;
        gap: 0.75rem;
    }

    /* Code blocks */
    .code-block {
        padding: 0.875rem;
        font-size: 0.8rem;
    }

    pre code {
        font-size: 0.78rem;
    }

    /* Docs grid */
    .doc-info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* API key display */
    .api-key-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .key-display {
        width: 100%;
        flex-direction: column;
        gap: 6px;
    }

    /* Bulk form */
    .campaign-info-grid {
        grid-template-columns: 1fr !important;
    }

    /* Templates grid */
    .templates-grid {
        grid-template-columns: 1fr;
    }

    /* Scheduled messages table */
    .scheduled-table th:nth-child(3),
    .scheduled-table td:nth-child(3),
    .scheduled-table th:nth-child(4),
    .scheduled-table td:nth-child(4) {
        display: none;
    }

    /* Connection badge */
    .connection-badge {
        font-size: 0.7rem;
        padding: 3px 10px;
    }

    /* Plans grid */
    .plans-grid {
        grid-template-columns: 1fr;
    }

    /* Appearance page */
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .color-theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Auto-replies table */
    .autoreplies-table th:nth-child(2),
    .autoreplies-table td:nth-child(2) {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Proxy settings */
    #tab-proxy .row.g-3 {
        gap: 0.75rem;
    }

    /* Performance: d-flex gap-2 buttons stack on mobile */
    #tab-proxy .d-flex.gap-2 {
        flex-direction: column;
        align-items: stretch;
    }

    #tab-proxy .d-flex.gap-2 .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ---------- Small Mobile (≤575px) ---------- */
@media (max-width: 575px) {

    /* Stats: stack to 2 still but smaller */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.625rem;
    }

    .stat-card {
        padding: 0.875rem 0.75rem;
        gap: 0.75rem;
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .stat-card-number {
        font-size: 1.1rem;
    }

    .stat-card-label {
        font-size: 0.65rem;
    }

    /* Main padding */
    .dashboard-main {
        padding: calc(56px + 1rem) 0.875rem 1rem;
    }

    /* Panel */
    .panel-body {
        padding: 1rem;
    }

    .panel-header {
        padding: 0.875rem 1rem;
    }

    /* QR: smaller on tiny phones */
    .qr-real-image {
        width: 180px;
        height: 180px;
    }

    /* Disconnected icon */
    .disconnected-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .connected-icon,
    .error-icon {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }

    /* Inbox */
    .inbox-item {
        padding: 0.75rem 0.875rem;
    }

    .inbox-avatar {
        width: 36px;
        height: 36px;
    }

    /* Buttons */
    .btn-glow {
        padding: 11px 24px;
        font-size: 0.9rem;
    }

    .btn-glow.btn-lg {
        width: 100%;
    }

    /* Form controls */
    .form-control,
    .form-select {
        font-size: 0.9rem;
    }

    /* Section title */
    .section-title {
        font-size: 1.5rem;
    }

    /* Hide extra table columns */
    .inbox-footer {
        display: none;
    }

    /* Code blocks need horizontal scroll */
    .code-block,
    pre {
        overflow-x: auto;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    /* Badge text in panel header */
    .connection-badge span {
        display: none;
    }

    .connection-badge .status-dot {
        margin: 0;
    }
}

/* ---------- Fix: Sidebar Open State on Mobile (overlay approach) ---------- */
@media (max-width: 991px) {

    /* Remove collapsed class margin on small screens */
    .dashboard-main.sidebar-collapsed {
        margin-left: 0 !important;
    }

    /* Sidebar toggle in mobile topbar controls overlay open */
    .dashboard-sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
    }

    /* Overlay visible when sidebar open */
    .sidebar-overlay.open {
        display: block;
    }

    /* Don't show collapsed sidebar on mobile — either full or hidden */
    .dashboard-sidebar.collapsed {
        width: 260px !important;
        transform: translateX(-100%);
    }

    .dashboard-sidebar.collapsed.open {
        transform: translateX(0);
    }
}


/* ========================================
   New Dashboard Enhancements
   ======================================== */

/* Removed conflicting sidebar-header flex properties */

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-section-label {
    display: block;
    padding: 0.5rem 1.5rem;
    color: #4ade80;
    font-weight: 600;
    text-transform: uppercase;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: rgba(37, 211, 102, 0.3);
}

.sidebar-top-header {
    padding: 1rem 1.125rem 0;
    /* 18px from left */
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.dashboard-sidebar.collapsed .sidebar-top-header {
    padding: 1rem 0 0 0;
    /* justify-content: center in 72px sidebar with 36px button puts button left edge at 18px */
    justify-content: center;
}

.dashboard-sidebar.collapsed .sidebar-header {
    padding: 1rem 0;
    display: flex;
    justify-content: center;
}

/* ---------- Sidebar Avatar (Image + Initials) ---------- */
.user-avatar-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--gradient-1);
    position: relative;
}

.user-avatar-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initials {
    font-size: 1.3rem;
    font-weight: 800;
    color: #000;
}

/* ---------- Collapsed Sidebar ---------- */
.dashboard-sidebar.collapsed {
    width: 72px;
}

.dashboard-sidebar.collapsed .sidebar-user .user-info,
.dashboard-sidebar.collapsed .sidebar-link span,
.dashboard-sidebar.collapsed .sidebar-footer,
.dashboard-sidebar.collapsed .sidebar-section-label,
.dashboard-sidebar.collapsed .nav-badge {
    display: none;
}

.dashboard-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 12px;
}

.dashboard-sidebar.collapsed .sidebar-link i {
    margin: 0;
    font-size: 1.3rem;
}

.dashboard-sidebar.collapsed .sidebar-header .sidebar-user {
    justify-content: center;
}

.dashboard-sidebar.collapsed .sidebar-toggle-btn {
    margin: 0 auto;
}

.dashboard-main.sidebar-collapsed {
    margin-left: 72px;
}

.dashboard-sidebar.collapsed .sidebar-divider {
    margin: 0.25rem 0.5rem;
}

/* ---------- Profile Tab - Avatar Upload ---------- */
.profile-avatar-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 1rem;
}

.profile-avatar-big {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.15);
}

.profile-avatar-big img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initials-big {
    font-size: 1.8rem;
    font-weight: 800;
    color: #000;
}

.avatar-camera-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.profile-avatar-big:hover .avatar-camera-overlay {
    opacity: 1;
}

/* ---------- No Plan Overlay ---------- */
.no-plan-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.no-plan-content i {
    font-size: 3rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 1rem;
}

.no-plan-content h5 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.no-plan-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ---------- Plan Activation Modal ---------- */
.plan-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.plan-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 3rem 2.5rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: scaleIn 0.4s ease;
}

.plan-modal-icon {
    font-size: 4rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.plan-modal-box h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.plan-modal-box p {
    margin-bottom: 1.5rem;
}

/* ---------- Account Info Chips ---------- */
.account-info-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.account-info-chip i {
    color: var(--accent);
    margin-right: 4px;
}

/* ---------- Profile Tab Form Overrides ---------- */
#tab-profile .form-floating>.form-control {
    border-radius: var(--radius-sm);
}

#tab-profile .form-floating>.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

#tab-profile .form-floating label {
    color: var(--text-muted);
}

#tab-profile .alert-success {
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.3);
    color: var(--accent);
    border-radius: var(--radius-sm);
}

#tab-profile .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: var(--radius-sm);
}

/* ---------- Live Chat & Groups Selected States ---------- */
.live-chat-item.active-chat-item {
    background: rgba(37, 211, 102, 0.15) !important;
    border-left: 3px solid var(--accent) !important;
}

.group-list-item.active-group-item {
    background: rgba(37, 211, 102, 0.15) !important;
    border-color: var(--accent) !important;
    border-left: 3px solid var(--accent) !important;
}

/* ---------- Live Chat Layout & Responsiveness ---------- */
.livechat-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 768px) {
    .livechat-sidebar {
        width: 100% !important;
    }
    .livechat-conversation {
        width: 100% !important;
        display: none !important;
    }
    .livechat-conversation.active {
        display: flex !important;
    }
    .livechat-sidebar.inactive {
        display: none !important;
    }
}