/* DialerPlatform Design System — Premium SaaS Theme */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
    --sidebar-hover: #1e293b;
    --topbar-height: 56px;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.05);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --primary: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
}

* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
body { margin: 0; background: var(--content-bg); color: var(--text-primary); font-size: 0.875rem; }

/* === SIDEBAR === */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform 0.2s ease;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.4); }
}

.sidebar-header {
    padding: 1.15rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-brand {
    color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem;
    display: flex; align-items: center; gap: 0.6rem;
    white-space: nowrap;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand i { font-size: 1.3rem; color: var(--primary); }
.sidebar-brand img { height: 26px; }
.sidebar-close { background: none; border: none; color: var(--sidebar-text); font-size: 1.2rem; cursor: pointer; padding: 0; }

.sidebar-nav { flex: 1; padding: 0.5rem 0; overflow-y: auto; }
.nav-section { padding: 0 0.75rem; }
.nav-section-label {
    padding: 1.1rem 1.25rem 0.35rem;
    font-size: 0.625rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: #475569;
    white-space: nowrap;
}

.nav-item {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.45rem 0.75rem; margin: 1px 0;
    color: var(--sidebar-text); text-decoration: none;
    border-radius: 0.5rem; font-size: 0.8125rem; font-weight: 500;
    transition: all 0.12s ease;
    white-space: nowrap;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: rgba(59,130,246,0.12); color: #fff; }
.nav-item.active i { color: var(--primary); }
.nav-item i { font-size: 1.05rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.nav-badge {
    margin-left: auto; background: var(--success); color: #fff;
    font-size: 0.6rem; padding: 0.125rem 0.4rem; border-radius: 10px; font-weight: 600;
    line-height: 1.4;
}

.sidebar-footer {
    padding: 0.65rem 0.75rem; border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.4rem 0.5rem 0.35rem;
}
.sidebar-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.8rem; flex-shrink: 0;
}
.sidebar-user-name { color: #e2e8f0; font-weight: 600; font-size: 0.8125rem; line-height: 1.3; }
.sidebar-user-email { color: #64748b; font-size: 0.7rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.logout-link { margin-top: 0.15rem; }
.logout-link:hover { color: var(--danger) !important; }

/* === MAIN CONTENT === */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex; flex-direction: column;
}
@media (max-width: 991px) { .main-content { margin-left: 0; } }

.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 1030;
    flex-shrink: 0;
}
.topbar-toggle { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-primary); padding: 0.25rem; }
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

.content-wrapper { padding: 1.5rem; flex: 1; }
@media (max-width: 576px) { .content-wrapper { padding: 1rem; } }

/* === BREADCRUMBS === */
.breadcrumb { margin: 0; font-size: 0.8125rem; background: transparent; padding: 0; }
.breadcrumb-item a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 600; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-secondary); }

/* === CARDS === */
.card {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: 0.75rem; box-shadow: var(--card-shadow);
}
.card-header {
    background: transparent; border-bottom: 1px solid var(--card-border);
    font-weight: 600; font-size: 0.8125rem; padding: 0.75rem 1.25rem;
}

/* === STAT CARDS === */
.stat-card { border: none; border-left: 3px solid var(--primary); }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-card .stat-label { font-size: 0.675rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-card .stat-icon { font-size: 1.75rem; opacity: 0.35; }
.stat-card.success, .card.border-start.border-success { border-left-color: var(--success) !important; }
.stat-card.success .stat-icon { color: var(--success); }
.stat-card.warning, .card.border-start.border-warning { border-left-color: var(--warning) !important; }
.stat-card.danger, .card.border-start.border-danger { border-left-color: var(--danger) !important; }
.stat-card.info, .card.border-start.border-info { border-left-color: var(--info) !important; }

/* === TABLES === */
.table { font-size: 0.8125rem; margin-bottom: 0; }
.table th {
    font-weight: 600; font-size: 0.7rem; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-secondary);
    border-bottom: 2px solid var(--card-border);
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
}
.table td { padding: 0.6rem 0.75rem; vertical-align: middle; border-bottom-color: #f1f5f9; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(0,0,0,0.015); }
.table-light { --bs-table-bg: #f8fafc; }

/* === BADGES === */
.badge { font-weight: 500; font-size: 0.7rem; padding: 0.275em 0.55em; border-radius: 0.375rem; }
.badge-status-1, .badge-paused { background: #e2e8f0; color: #475569; }
.badge-status-2, .badge-running, .badge-started { background: #dcfce7; color: #166534; }
.badge-status-3, .badge-stopped { background: #fee2e2; color: #991b1b; }
.badge-status-4, .badge-ended { background: #f1f5f9; color: #334155; }

/* === BUTTONS === */
.btn { font-size: 0.8125rem; font-weight: 500; border-radius: 0.5rem; padding: 0.4rem 1rem; transition: all 0.15s ease; }
.btn-sm { font-size: 0.75rem; padding: 0.3rem 0.65rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #2563eb; border-color: #2563eb; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }

/* === FORMS === */
.form-control, .form-select { font-size: 0.8125rem; border-radius: 0.5rem; border-color: var(--card-border); padding: 0.45rem 0.75rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-control-sm, .form-select-sm { font-size: 0.8125rem; padding: 0.3rem 0.65rem; }
.form-label { font-weight: 600; font-size: 0.8125rem; color: var(--text-primary); margin-bottom: 0.35rem; }
.form-text { font-size: 0.75rem; color: var(--text-secondary); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.input-group-text { font-size: 0.8125rem; border-color: var(--card-border); background: #f8fafc; }

/* === PAGE HEADER === */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.page-header h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }

/* === PROGRESS BAR === */
.progress { border-radius: 0.5rem; height: 0.5rem; background: #e2e8f0; }
.progress-bar { border-radius: 0.5rem; }

/* === AUTH PAGES === */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    padding: 1rem;
}
.auth-card {
    background: #fff; border-radius: 1rem; padding: 2.5rem;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.05);
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo i { font-size: 2.5rem; color: var(--primary); }
.auth-logo img { height: 50px; margin-bottom: 0.5rem; }
.auth-logo h2 { font-size: 1.35rem; font-weight: 700; margin: 0.5rem 0 0.25rem; color: var(--text-primary); }
.auth-logo p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); }
.empty-state i { font-size: 3rem; opacity: 0.3; }
.empty-state p { margin-top: 0.75rem; }

/* === PAGINATION === */
.pagination { gap: 0.25rem; }
.pagination .page-link { font-size: 0.8125rem; border-radius: 0.375rem; padding: 0.35rem 0.65rem; border-color: var(--card-border); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* === MISC === */
.text-muted { color: var(--text-secondary) !important; }
code { font-size: 0.8rem; }
pre { background: #f8fafc; padding: 1rem; border-radius: 0.5rem; white-space: pre-wrap; word-break: break-word; font-size: 0.8125rem; }
.alert { font-size: 0.8125rem; border-radius: 0.5rem; }
.list-group-item { font-size: 0.8125rem; border-color: var(--card-border); }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
a { color: var(--primary); }
a:hover { color: #2563eb; }

/* === MOBILE OVERLAY === */
.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1035;
}
.sidebar.show ~ .sidebar-overlay { display: block; }

/* === SCROLLBAR === */
.content-wrapper::-webkit-scrollbar { width: 6px; }
.content-wrapper::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* === RESPONSIVE TWEAKS === */
@media (max-width: 767px) {
    .d-flex.gap-2.flex-wrap { gap: 0.35rem !important; }
    .btn { padding: 0.35rem 0.75rem; }
    h2 { font-size: 1.1rem; }
}

/* === CHART CARD === */
.card canvas { max-width: 100%; }

/* === CARD FOOTER === */
.card-footer { background: #f8fafc; border-top: 1px solid var(--card-border); font-size: 0.8125rem; }

/* === SHADOW VARIANTS === */
.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important; }

/* === DISPLAY OVERRIDES for correct text sizing in new theme === */
.fs-2 { font-size: 1.5rem !important; }
.display-6 { font-size: 1.75rem !important; }

/* === AUTH PAGE BODY === */
body.auth-page { background: transparent; }

