/* ==========================================================================
   GreenMile Dashboard CSS - Curated Premium Aesthetics (Vanilla CSS)
   ========================================================================== */

/* Color Tokens & Reset */
:root {
    --bg-primary: #0f101a;
    --bg-secondary: #151624;
    --bg-card: #1c1d2e;
    --bg-card-hover: #23253b;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Accents HSL Harmonized */
    --accent-emerald: #10b981;
    --accent-emerald-opaque: rgba(16, 185, 129, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-opaque: rgba(59, 130, 246, 0.15);
    --accent-purple: #c69ff0;
    --accent-purple-opaque: rgba(198, 159, 240, 0.15);
    --accent-gold: #f59e0b;
    --accent-gold-opaque: rgba(245, 158, 11, 0.15);
    --accent-rose: #f43f5e;
    --accent-rose-opaque: rgba(244, 63, 94, 0.15);
    
    --sidebar-width: 260px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    height: 100vh;
}

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

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

.text-emerald { color: var(--accent-emerald); }
.text-blue { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }
.text-gold { color: var(--accent-gold); }
.text-error { color: #ef4444; }
.text-red { color: var(--accent-rose); }
.font-mono { font-family: 'Courier New', Courier, monospace; }
.font-bold { font-weight: 600; }
.font-normal { font-weight: 400; }

/* -------------------------------------------------------------
   App Container & Sidebar
   ------------------------------------------------------------- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

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

.brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-blue));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.logo-icon {
    font-size: 18px;
    color: #fff;
}

.brand-text h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 24px 16px;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 6px;
    transition: var(--transition-smooth);
    font-weight: 500;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    transition: var(--transition-smooth);
}

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

.nav-item.active {
    background: linear-gradient(90deg, var(--accent-purple-opaque) 0%, rgba(59, 130, 246, 0.03) 100%);
    border-left: 3px solid var(--accent-purple);
    color: var(--accent-purple);
    padding-left: 13px; /* account for border width to prevent shifting */
}

.nav-item.active i {
    color: var(--accent-purple);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.connection-status-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    background-color: var(--accent-blue);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-blue);
}

.connection-status-card.live-mode .status-indicator {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
}

.status-info .status-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-info .status-sub {
    font-size: 10px;
    color: var(--text-secondary);
}

/* -------------------------------------------------------------
   Main Workspace Layout
   ------------------------------------------------------------- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
}

.top-navbar {
    height: 76px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    flex-shrink: 0;
}

.top-nav-left h1 {
    font-size: 22px;
    color: var(--text-primary);
}

.top-nav-left p {
    font-size: 12px;
    margin-top: 2px;
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.api-key-indicator {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.api-key-indicator:hover {
    border-color: var(--border-hover);
    background-color: var(--bg-card-hover);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 20px;
    border-left: 1px solid var(--border-color);
}

.avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
}

/* -------------------------------------------------------------
   Content Viewport & Tabs
   ------------------------------------------------------------- */
.content-viewport {
    flex-grow: 1;
    overflow-y: auto;
    padding: 32px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

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

/* -------------------------------------------------------------
   Tab 1: Dashboard Overview CSS
   ------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--accent-emerald), var(--accent-blue));
    transition: var(--transition-smooth);
}

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

.stat-card:hover::after {
    width: 100%;
}

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

.stat-icon-wrapper.blue { background-color: var(--accent-blue-opaque); color: var(--accent-blue); }
.stat-icon-wrapper.green { background-color: var(--accent-emerald-opaque); color: var(--accent-emerald); }
.stat-icon-wrapper.purple { background-color: var(--accent-purple-opaque); color: var(--accent-purple); }
.stat-icon-wrapper.gold { background-color: var(--accent-gold-opaque); color: var(--accent-gold); }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 26px;
    font-family: var(--font-heading);
    margin: 4px 0;
    color: var(--text-primary);
}

.stat-change {
    font-size: 11px;
}

/* Analytics Row Charts */
.analytics-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 1024px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

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

.chart-header h3 {
    font-size: 16px;
    color: var(--text-primary);
}

.badge {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 260px;
}

.chart-wrapper.donut {
    height: 260px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Overview splits */
.overview-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .overview-split-grid {
        grid-template-columns: 1fr;
    }
}

.overview-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.panel-header h3 {
    font-size: 16px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-emerald);
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
    transition: var(--transition-smooth);
}

.btn-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.live-pulse-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-rose);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.live-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-rose);
    letter-spacing: 0.05em;
}

/* Fallback card styles */
.no-campaign-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    text-align: center;
    color: var(--text-secondary);
}

.fallback-icon {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Recent list feed */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-call-item {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.recent-call-item:hover {
    border-color: var(--border-hover);
    background-color: var(--bg-card-hover);
    transform: translateX(4px);
}

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

.avatar-call-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.recent-call-item:hover .avatar-call-icon {
    color: var(--accent-emerald);
}

.item-info .number {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-heading);
}

.item-info .time {
    font-size: 11px;
    color: var(--text-secondary);
}

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

.call-item-duration {
    font-size: 12px;
    color: var(--text-secondary);
}

/* -------------------------------------------------------------
   General Buttons & Components
   ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), #a876e6);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(198, 159, 240, 0.2);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(198, 159, 240, 0.3);
}

.btn-outline {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--bg-card);
    border-color: var(--text-muted);
}

.btn-xs {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

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

/* Status Badges */
.badge-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    text-transform: capitalize;
}

.badge-status.completed { background-color: var(--accent-emerald-opaque); color: var(--accent-emerald); }
.badge-status.in_progress, .badge-status.in-progress { background-color: var(--accent-blue-opaque); color: var(--accent-blue); }
.badge-status.pending { background-color: var(--bg-primary); border: 1px solid var(--border-color); color: var(--text-secondary); }
.badge-status.busy { background-color: var(--accent-gold-opaque); color: var(--accent-gold); }
.badge-status.failed { background-color: var(--accent-rose-opaque); color: var(--accent-rose); }
.badge-status.no-answer, .badge-status.no_answer { background-color: var(--accent-rose-opaque); color: var(--accent-rose); }
.badge-status.paused { background-color: var(--accent-purple-opaque); color: var(--accent-purple); }
.badge-status.cancelled { background-color: rgba(255, 255, 255, 0.05); color: var(--text-muted); }

.badge-sentiment {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}
.badge-sentiment.positive { background-color: var(--accent-emerald-opaque); color: var(--accent-emerald); }
.badge-sentiment.neutral { background-color: var(--accent-blue-opaque); color: var(--accent-blue); }
.badge-sentiment.negative { background-color: var(--accent-rose-opaque); color: var(--accent-rose); }

/* -------------------------------------------------------------
   Tab 2: Campaigns Tab Styling
   ------------------------------------------------------------- */
.section-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.search-box-wrapper {
    position: relative;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 320px;
    height: 42px;
}

.search-box-wrapper input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-family: var(--font-body);
    font-size: 13px;
}

.search-box-wrapper i {
    color: var(--text-muted);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0 16px;
    height: 42px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

/* Campaigns Cards Layout */
.campaigns-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.campaign-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

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

.camp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.camp-title-block h3 {
    font-size: 15px;
    margin-bottom: 2px;
}

.camp-title-block span {
    font-size: 11px;
    color: var(--text-secondary);
}

.camp-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.camp-stat-box {
    display: flex;
    flex-direction: column;
}

.camp-stat-box .label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.camp-stat-box .val {
    font-size: 13px;
    font-weight: 600;
}

/* Campaign Progress Bar */
.camp-progress-container {
    margin-bottom: 18px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 6px;
    font-weight: 500;
}

.progress-track {
    height: 6px;
    background-color: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-emerald), var(--accent-blue));
    width: 0%;
    transition: width 0.5s ease;
}

.camp-actions-row {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

/* -------------------------------------------------------------
   Sliding Drawer & Forms CSS
   ------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    animation: fadeInBackdrop 0.3s ease;
}

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

.drawer {
    position: fixed;
    top: 0;
    right: -480px;
    width: 480px;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer.open {
    right: 0;
}

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

.drawer-header h2 {
    font-size: 18px;
}

.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

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

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

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

label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.required {
    color: var(--accent-rose);
}

input[type="text"], input[type="number"], input[type="password"], textarea {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.field-desc {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Slider controls */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

input[type="range"] {
    flex-grow: 1;
    accent-color: var(--accent-emerald);
}

.slider-wrapper span {
    font-size: 12px;
    font-weight: 600;
    min-width: 60px;
}

/* Switch control */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-top: 6px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--accent-emerald-opaque);
    border-color: var(--accent-emerald);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: var(--accent-emerald);
}

/* Accordion sections */
.accordion-section {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.accordion-header {
    background-color: var(--bg-card);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.accordion-header:hover {
    background-color: var(--bg-card-hover);
}

.accordion-header .arrow-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.accordion-header.active .arrow-icon {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 500px;
    padding: 0 16px 16px 16px;
    background-color: var(--bg-secondary);
    transition: max-height 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.accordion-body.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    cursor: pointer;
}

.disabled-target {
    opacity: 0.4;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.disabled-target.active {
    opacity: 1;
    pointer-events: auto;
}

/* -------------------------------------------------------------
   Tab 3: Call Logs & Pagination CSS
   ------------------------------------------------------------- */
.table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow-x: auto;
    margin-bottom: 20px;
}

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

.data-table th {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 16px 20px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: var(--transition-smooth);
    cursor: pointer;
}

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

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.current-page-num {
    font-size: 12px;
    font-weight: 600;
}

/* Audio Player inside Table */
.btn-table-play {
    background: none;
    border: none;
    color: var(--accent-emerald);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.btn-table-play:hover {
    color: var(--text-primary);
}

.no-rec-val {
    font-size: 11px;
    color: var(--text-muted);
}

/* -------------------------------------------------------------
   Tab 4: Settings Tab CSS
   ------------------------------------------------------------- */
.settings-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.card-header {
    background-color: var(--bg-secondary);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header p {
    font-size: 11px;
    margin-top: 4px;
}

.card-body {
    padding: 24px;
}

.settings-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

.connection-stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conn-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
}

.conn-stat-item .label {
    color: var(--text-secondary);
}

/* -------------------------------------------------------------
   Call Details Rich Slide Panel (Modal Drawer)
   ------------------------------------------------------------- */
.call-details-drawer {
    position: fixed;
    top: 0;
    right: -80%;
    width: 80%;
    max-width: 960px;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .call-details-drawer {
        width: 100%;
        right: -100%;
    }
}

.call-details-drawer.open, .campaign-details-drawer.open {
    right: 0;
}

.camp-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid currentColor;
}
.camp-status-badge.pending { color: var(--accent-yellow); }
.camp-status-badge.in_progress { color: var(--accent-blue); }
.camp-status-badge.completed { color: var(--accent-emerald); }
.camp-status-badge.cancelled { color: var(--text-secondary); }
.camp-status-badge.failed { color: var(--accent-rose); }
.camp-status-badge.paused { color: var(--accent-yellow); }

.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    background-color: var(--bg-secondary);
}

.drawer-tabs .tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.drawer-tabs .tab-btn:hover {
    color: var(--text-primary);
}

.drawer-tabs .tab-btn.active {
    color: var(--accent-emerald);
    border-bottom-color: var(--accent-emerald);
}

.camp-tab-pane {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.camp-tab-pane.active {
    display: block;
}

.drawer-content-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    flex-grow: 1;
    overflow: hidden;
}

@media (max-width: 900px) {
    .drawer-content-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .drawer-info-panel, .drawer-transcript-panel {
        overflow: visible !important;
    }
}

.drawer-info-panel {
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drawer-transcript-panel {
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.panel-header-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.badge-outline {
    border: 1px solid var(--accent-emerald);
    color: var(--accent-emerald);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.info-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 8px;
}

.meta-label {
    color: var(--text-secondary);
}

.meta-val {
    color: var(--text-primary);
}

.recording-container audio {
    width: 100%;
    margin-top: 6px;
    outline: none;
}

/* Chat bubble transcript */
.transcript-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 4px;
    max-height: 520px;
}

.chat-bubble-wrapper {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.chat-bubble-wrapper.bot {
    align-self: flex-start;
}

.chat-bubble-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

.chat-bubble-wrapper.bot .chat-avatar {
    background-color: var(--accent-emerald);
}

.chat-bubble-wrapper.user .chat-avatar {
    background-color: var(--accent-blue);
}

.chat-body-content {
    display: flex;
    flex-direction: column;
}

.chat-bubble-text {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.chat-bubble-wrapper.bot .chat-bubble-text {
    border-top-left-radius: 0;
    border-left: 3px solid var(--accent-emerald);
}

.chat-bubble-wrapper.user .chat-bubble-text {
    border-top-right-radius: 0;
    background-color: var(--bg-card-hover);
    border-color: rgba(59, 130, 246, 0.2);
}

.chat-timestamp {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.chat-bubble-wrapper.user .chat-timestamp {
    text-align: right;
}

.sentiment-details-callout {
    background-color: rgba(16, 185, 129, 0.05);
    border-left: 3px solid var(--accent-emerald);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.sentiment-title {
    color: var(--accent-emerald);
    margin-bottom: 2px;
}

/* Variables table custom style */
.variables-table-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.var-row {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.var-key {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.var-val {
    font-size: 12px;
    font-weight: 500;
}

/* Live Active Campaign Progress Board Details */
.live-progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.live-progress-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.live-progress-box .label {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: block;
}

.live-progress-box .val {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
}

.live-campaign-meta {
    font-size: 12px;
    margin-bottom: 12px;
}

.live-campaign-meta p {
    margin-bottom: 6px;
}

.live-campaign-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--bg-card);
    border: 1px solid var(--accent-emerald);
    border-left: 4px solid var(--accent-emerald);
    box-shadow: var(--shadow-lg);
    padding: 14px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
    transform: translateY(0);
}

.toast-icon {
    color: var(--accent-emerald);
    font-size: 16px;
}

.toast-message {
    font-size: 13px;
    font-weight: 500;
}

/* --- UX & FILTERING OVERHAUL --- */

/* Floating Action Bar */
.floating-action-bar {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 2000;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.floating-action-bar.visible {
    bottom: 30px;
    pointer-events: auto;
}

.fab-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 30px;
}

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

.selected-count-badge {
    background-color: var(--accent-emerald);
    color: white;
    font-weight: bold;
    font-size: 14px;
    height: 24px;
    min-width: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.fab-text {
    font-weight: 500;
    font-size: 14px;
}

.fab-right {
    display: flex;
    gap: 12px;
}

/* Skeleton Loader */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton-row td {
    position: relative;
    overflow: hidden;
}

.skeleton-row td::after {
    content: "";
    display: block;
    width: 100%;
    height: 16px;
    border-radius: 4px;
    background: #2a3441;
    background-image: linear-gradient(to right, #2a3441 0%, #354252 20%, #2a3441 40%, #2a3441 100%);
    background-repeat: no-repeat;
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear forwards;
}

/* Filter Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-grid input[type="checkbox"] {
    accent-color: var(--accent-emerald);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-col {
    width: 40px;
    text-align: center;
}

.checkbox-col input {
    accent-color: var(--accent-emerald);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Smooth Table Row Transitions */
.data-table tbody tr {
    transition: background-color 0.2s ease;
}

/* Sortable Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

th.sortable:hover {
    color: var(--accent-emerald);
}

th.sortable i {
    margin-left: 10px;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.sortable:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.sortable i {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 11px;
}

th.sortable.active-sort {
    color: var(--accent-emerald);
}

th.sortable.active-sort i {
    opacity: 1;
}

/* -------------------------------------------------------------
   Full-Page Campaign Dashboard Styles
   ------------------------------------------------------------- */
.camp-dash-header {
    display: flex;
    align-items: center;
    padding-bottom: 24px;
}

.camp-dash-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.dash-tabs {
    margin-top: 24px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0;
}

.dash-tabs .tab-btn {
    font-size: 14px;
    padding: 12px 24px;
    border-bottom: 2px solid transparent;
    border-radius: 0;
}

.dash-tabs .tab-btn.active {
    background: transparent;
    color: var(--text-primary);
    border-bottom-color: var(--accent-emerald);
}

.audio-inline {
    height: 32px;
    width: 200px;
    outline: none;
}

.audio-inline::-webkit-media-controls-panel {
    background-color: var(--bg-card);
}

.audio-inline::-webkit-media-controls-play-button,
.audio-inline::-webkit-media-controls-mute-button {
    filter: invert(1);
}

.audio-inline::-webkit-media-controls-current-time-display,
.audio-inline::-webkit-media-controls-time-remaining-display {
    color: var(--text-primary);
}

/* Call Lines Aesthetic Overhaul */
.call-lines-container h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.filter-controls .input, .filter-controls select {
    background-color: #1e1e2d;
    border: 1px solid #323248;
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 14px;
    transition: var(--transition-smooth);
}

.filter-controls .input:focus, .filter-controls select:focus {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.filter-controls .input::placeholder {
    color: #6b7280;
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clickable-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.clickable-row td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pagination-bar {
    background-color: transparent;
    border-top: none;
}

.pagination-bar .btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.pagination-bar .btn-outline:hover:not(:disabled) {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}
