/* ==========================================================================
   Olwin Store WhatsApp Cloud API & VPS Infrastructure Dashboard
   Design System: Dark Glassmorphism, Neon Accents, Cyberpunk Terminal
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #07090e;
    --bg-surface: #0e131f;
    --bg-card: rgba(15, 23, 42, 0.65);
    --bg-card-hover: rgba(26, 38, 66, 0.75);
    --bg-glass-input: rgba(11, 17, 30, 0.7);
    
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-bright: rgba(255, 255, 255, 0.15);
    --border-glow-indigo: rgba(99, 102, 241, 0.4);
    --border-glow-emerald: rgba(16, 185, 129, 0.4);
    --border-glow-amber: rgba(245, 158, 11, 0.4);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Accent Colors */
    --emerald-500: #10b981;
    --emerald-400: #34d399;
    --emerald-glow: rgba(16, 185, 129, 0.25);
    
    --indigo-500: #6366f1;
    --indigo-400: #818cf8;
    --indigo-glow: rgba(99, 102, 241, 0.3);

    --cyan-500: #06b6d4;
    --cyan-400: #22d3ee;
    --cyan-glow: rgba(6, 182, 212, 0.25);

    --amber-500: #f59e0b;
    --amber-400: #fbbf24;
    --amber-glow: rgba(245, 158, 11, 0.25);

    --rose-500: #f43f5e;
    --rose-400: #fb7185;
    --rose-glow: rgba(244, 63, 94, 0.25);

    /* UI Measurements */
    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography Overrides */
h1, h2, h3, h4, .font-heading {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

code, pre, .font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Animated Ambient Glow Background */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: rgba(7, 9, 14, 0.6);
}

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

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

/* --------------------------------------------------------------------------
   Layout Containers
   -------------------------------------------------------------------------- */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1.75rem 2.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Glassmorphism Card System */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-bright);
}

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.015);
}

.card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-body {
    padding: 1.25rem 1.35rem;
}

/* --------------------------------------------------------------------------
   App Header & Brand Section
   -------------------------------------------------------------------------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    color: #ffffff;
    box-shadow: 0 0 25px var(--emerald-glow), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: var(--transition-fast);
}

.brand-logo:hover {
    transform: scale(1.04) rotate(-3deg);
}

.brand-title h1 {
    font-size: 1.55rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-title .subtitle {
    font-size: 0.825rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Header Status Badges & Clock */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.85rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(12px);
    border: 1px solid transparent;
}

.status-connected {
    background: rgba(16, 185, 129, 0.12);
    color: var(--emerald-400);
    border-color: rgba(16, 185, 129, 0.3);
}

.status-disconnected {
    background: rgba(244, 63, 94, 0.12);
    color: var(--rose-400);
    border-color: rgba(244, 63, 94, 0.3);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 10px currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.35); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.live-clock-badge {
    background: rgba(99, 102, 241, 0.12);
    color: var(--indigo-400);
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 0.4rem 0.85rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* --------------------------------------------------------------------------
   Master Navigation Tabs Bar
   -------------------------------------------------------------------------- */
.project-tabs-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-xl);
    background: rgba(11, 16, 28, 0.75);
    border: 1px solid var(--border-subtle);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tabs-list {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 1.1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(16, 185, 129, 0.2) 100%);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

.tab-btn i {
    font-size: 1.05rem;
    color: var(--indigo-400);
}

.tab-btn.active i {
    color: var(--emerald-400);
}

.tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--emerald-400);
    box-shadow: 0 0 8px var(--emerald-400);
}

.unread-badge {
    background: var(--rose-500);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
}

.vps-tag {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vps-tag code {
    color: var(--cyan-400);
}

/* Tab Panels */
.tab-panel {
    display: block;
    animation: fadeIn 0.3s ease;
}

.tab-panel.hidden {
    display: none !important;
}

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

/* --------------------------------------------------------------------------
   Tab 1: WhatsApp Engine - Metrics Grid
   -------------------------------------------------------------------------- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.metric-card {
    padding: 1.25rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.06), transparent 70%);
    pointer-events: none;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.icon-emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald-400);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.icon-rose {
    background: rgba(244, 63, 94, 0.15);
    color: var(--rose-400);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.icon-amber {
    background: rgba(245, 158, 11, 0.15);
    color: var(--amber-400);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.metric-data {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.metric-data h2 {
    font-size: 1.85rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
}

/* --------------------------------------------------------------------------
   Main Layout Grid (Left Config Column + Right Terminal)
   -------------------------------------------------------------------------- */
.main-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.25rem;
    align-items: start;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 1rem;
}

/* --------------------------------------------------------------------------
   Form Controls, Inputs & Buttons
   -------------------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.95rem;
    background: var(--bg-glass-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.form-control::placeholder {
    color: var(--text-dim);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .col {
    flex: 1;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%94a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.5rem;
    cursor: pointer;
}

select.form-control option {
    background: #0f172a;
    color: #ffffff;
}

/* Button System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--emerald-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--border-subtle);
}

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

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--amber-glow);
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--rose-glow);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.btn-icon.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--indigo-400);
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Helper Text Accent Classes */
.text-emerald { color: var(--emerald-400) !important; }
.text-blue { color: #60a5fa !important; }
.text-amber { color: var(--amber-400) !important; }
.text-rose { color: var(--rose-400) !important; }

/* Drag and Drop Zone */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 1.75rem 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.015);
    transition: var(--transition-fast);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--emerald-400);
    background: rgba(16, 185, 129, 0.05);
}

.drop-icon {
    font-size: 2.2rem;
    color: var(--emerald-400);
    margin-bottom: 0.5rem;
}

.drop-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.drop-subtext {
    font-size: 0.775rem;
    color: var(--text-muted);
}

.hidden-input {
    display: none;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    padding: 0.65rem 0.95rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
}

.file-count-tag {
    margin-left: auto;
    background: rgba(16, 185, 129, 0.2);
    color: var(--emerald-400);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Campaign Action Progress Bar */
.progress-section {
    margin-bottom: 1.2rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.progress-bar-container {
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 12px var(--emerald-glow);
}

/* Quick Catalogue Buttons */
.btn-quick-cat {
    outline: none;
}

.btn-quick-cat.active {
    border-color: rgba(16, 185, 129, 0.4) !important;
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--emerald-400) !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15);
}

.btn-quick-cat.active .check-icon {
    color: var(--emerald-400) !important;
}

/* Accordion */
.accordion-toggle {
    user-select: none;
}

.accordion-toggle:hover {
    background: rgba(255, 255, 255, 0.03);
}

.toggle-icon {
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.toggle-icon.collapsed {
    transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Live Execution Terminal Feed
   -------------------------------------------------------------------------- */
.terminal-card {
    height: calc(100vh - 170px);
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #090e18;
}

.terminal-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--cyan-400);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.terminal-actions {
    display: flex;
    gap: 0.4rem;
}

.terminal-body {
    flex: 1;
    background: #05070c;
    padding: 1rem 1.1rem;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.terminal-line {
    display: flex;
    gap: 0.6rem;
    word-break: break-word;
}

.terminal-line .timestamp {
    color: var(--text-dim);
    flex-shrink: 0;
}

.terminal-line.info .msg { color: #94a3b8; }
.terminal-line.success .msg { color: var(--emerald-400); }
.terminal-line.warn .msg { color: var(--amber-400); }
.terminal-line.error .msg { color: var(--rose-400); }

/* --------------------------------------------------------------------------
   Tab 2: Authentic WhatsApp Web Live Chat Interface
   -------------------------------------------------------------------------- */
.wa-web-container {
    display: flex;
    height: calc(100vh - 160px);
    min-height: 600px;
    background: #111b21;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.wa-sidebar {
    width: 360px;
    background: #111b21;
    border-right: 1px solid #222d34;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.wa-sidebar-header {
    height: 60px;
    background: #202c33;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wa-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #00a884;
    color: #111b21;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.wa-header-icons {
    display: flex;
    gap: 8px;
}

.wa-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #aebac1;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.wa-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e9edef;
}

.wa-search-bar {
    padding: 8px 12px;
    background: #111b21;
    display: flex;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid #222d34;
}

.wa-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.wa-search-icon {
    position: absolute;
    left: 12px;
    color: #8696a0;
    font-size: 0.9rem;
}

.wa-search-input {
    width: 100%;
    padding: 8px 12px 8px 38px;
    background: #202c33;
    border: none;
    border-radius: 8px;
    color: #e9edef;
    font-size: 0.875rem;
    outline: none;
}

.wa-search-input::placeholder { color: #8696a0; }

.wa-filter-btn {
    background: transparent;
    border: none;
    color: #8696a0;
    font-size: 1rem;
    cursor: pointer;
    padding: 6px;
}

.wa-conversations-list {
    flex: 1;
    overflow-y: auto;
}

.wa-chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(134, 150, 160, 0.15);
    transition: background 0.15s;
}

.wa-chat-item:hover, .wa-chat-item.active {
    background: #2a3942;
}

.wa-avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #6b7c85;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

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

.wa-chat-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.wa-chat-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #e9edef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-chat-time {
    font-size: 0.75rem;
    color: #8696a0;
}

.wa-chat-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wa-chat-preview {
    font-size: 0.825rem;
    color: #8696a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Main Section */
.wa-main {
    flex: 1;
    background: #0b141a;
    display: flex;
    flex-direction: column;
}

.wa-chat-header {
    height: 60px;
    background: #202c33;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #222d34;
}

.wa-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-contact-text h4 {
    font-size: 0.95rem;
    color: #e9edef;
    font-weight: 600;
}

.wa-status-text {
    font-size: 0.75rem;
    color: #8696a0;
}

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

.wa-messages-box {
    flex: 1;
    padding: 20px 5%;
    overflow-y: auto;
    background-color: #0b141a;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wa-welcome-placeholder {
    margin: auto;
    text-align: center;
    color: #8696a0;
    max-width: 420px;
}

.wa-web-hero-icon {
    font-size: 4rem;
    color: #00a884;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.wa-welcome-placeholder h2 {
    font-size: 1.5rem;
    color: #e9edef;
    margin-bottom: 0.5rem;
}

.wa-welcome-placeholder p {
    font-size: 0.875rem;
    line-height: 1.5;
}

.wa-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.775rem;
    color: #667781;
}

/* Chat Bubbles */
.wa-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}

.wa-bubble.inbound {
    align-self: flex-start;
    background: #202c33;
    color: #e9edef;
    border-top-left-radius: 0;
}

.wa-bubble.outbound {
    align-self: flex-end;
    background: #005c4b;
    color: #e9edef;
    border-top-right-radius: 0;
}

.wa-bubble-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: rgba(241, 241, 242, 0.63);
    margin-top: 4px;
}

.wa-input-footer {
    height: 62px;
    background: #202c33;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-msg-input {
    flex: 1;
    background: #2a3942;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    color: #e9edef;
    font-size: 0.9rem;
    outline: none;
}

.wa-msg-input::placeholder { color: #8696a0; }

.wa-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #00a884;
    border: none;
    color: #111b21;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-send-btn:hover { background: #029071; }

/* WA Dropdown & Popovers */
.wa-dropdown-menu {
    position: absolute;
    background: #233138;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    padding: 8px 0;
    z-index: 100;
    min-width: 200px;
}

.wa-dropdown-item {
    padding: 10px 16px;
    color: #d1d7db;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-dropdown-item:hover { background: #182229; color: #e9edef; }

.wa-popover {
    position: absolute;
    bottom: 70px;
    left: 20px;
    background: #233138;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    padding: 12px;
    z-index: 100;
}

.wa-popover-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8696a0;
    margin-bottom: 8px;
}

.wa-emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    font-size: 1.3rem;
}

.wa-emoji-grid span {
    cursor: pointer;
    text-align: center;
    padding: 4px;
    border-radius: 6px;
}

.wa-emoji-grid span:hover { background: #182229; }

.wa-attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wa-attachment-item strong { display: block; font-size: 0.825rem; color: #e9edef; }
.wa-attachment-item small { color: #8696a0; font-size: 0.725rem; }

/* Empty state icon */
.wa-empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: #8696a0;
}

.wa-empty-icon {
    font-size: 3rem;
    color: #00a884;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* --------------------------------------------------------------------------
   Tabs 3, 4, 5: Telemetry & Hub Cards
   -------------------------------------------------------------------------- */
.hub-card {
    min-height: 480px;
}

.hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hub-actions {
    display: flex;
    gap: 0.5rem;
}

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.telemetry-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.telemetry-card h4 {
    font-size: 1rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.5rem;
    margin-bottom: 0.2rem;
}

.telemetry-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.service-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.service-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--emerald-400);
    box-shadow: 0 0 8px var(--emerald-400);
}

/* Portal Cards */
.portal-hub-card:hover {
    border-color: rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   Login Overlay Modal
   -------------------------------------------------------------------------- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 15, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.25rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-icon-glow {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--indigo-400);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1rem auto;
    box-shadow: 0 0 30px var(--indigo-glow);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.login-header h2 {
    font-size: 1.4rem;
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-error {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--rose-400);
    padding: 0.65rem 0.95rem;
    border-radius: var(--radius-md);
    font-size: 0.825rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-dim);
    font-size: 0.775rem;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.app-footer {
    text-align: center;
    padding: 1.5rem 0 0.5rem 0;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   Responsive Layout Overrides
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .right-column {
        position: relative;
        top: 0;
    }

    .terminal-card {
        height: 450px;
    }

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

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-status {
        width: 100%;
        justify-content: space-between;
    }

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

    .wa-web-container {
        flex-direction: column;
        height: 700px;
    }

    .wa-sidebar {
        width: 100%;
        height: 300px;
    }

    .quick-cat-btn-group {
        grid-template-columns: 1fr !important;
    }
}
