@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0b1329;
    --bg-secondary: #17223b;
    --bg-tertiary: #263859;
    --bg-glass: rgba(23, 34, 59, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-emerald: #10b981;
    --accent-emerald-light: rgba(16, 185, 129, 0.15);
    --accent-cyan: #06b6d4;
    --accent-cyan-light: rgba(6, 182, 212, 0.15);
    --accent-amber: #f59e0b;
    --accent-amber-light: rgba(245, 158, 11, 0.15);
    --accent-rose: #f43f5e;
    --accent-rose-light: rgba(244, 63, 94, 0.15);
    --accent-indigo: #6366f1;
    --accent-indigo-light: rgba(99, 102, 241, 0.15);
    --accent-violet: #8b5cf6;
    
    --sidebar-width: 270px;
    --header-height: 70px;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: var(--border-hover);
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand i {
    -webkit-text-fill-color: var(--accent-emerald);
    font-size: 1.5rem;
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.menu-group {
    margin-bottom: 1.75rem;
}

.menu-group-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 0.75rem 0.5rem 0.75rem;
}

.menu-item {
    margin-bottom: 0.25rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
}

.menu-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.menu-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.menu-link:hover i {
    color: var(--accent-emerald);
}

.menu-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-cyan) 100%);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.menu-link.active i {
    color: #fff;
}

.user-profile {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(11, 19, 41, 0.4);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-cyan));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--header-height);
    background: rgba(11, 19, 41, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
    width: 260px;
}

.search-box input {
    width: 100%;
    background: rgba(23, 34, 59, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    background: rgba(23, 34, 59, 0.9);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(23, 34, 59, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

.icon-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-rose);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}

.content-body {
    padding: 2rem;
    flex: 1;
}

.page-header-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
}

.banner-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.banner-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 0.5rem;
}

.btn-emerald {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-emerald:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-cyan {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, #0891b2 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-cyan:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
}

.btn-rose {
    background: linear-gradient(135deg, var(--accent-rose) 0%, #e11d48 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}

.btn-rose:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.45);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
}

/* Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    padding: 1.35rem;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    background: var(--accent-emerald);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.metric-card.cyan::after { background: var(--accent-cyan); }
.metric-card.amber::after { background: var(--accent-amber); }
.metric-card.rose::after { background: var(--accent-rose); }
.metric-card.indigo::after { background: var(--accent-indigo); }

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.metric-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

.metric-card.cyan .metric-icon { background: var(--accent-cyan-light); color: var(--accent-cyan); }
.metric-card.amber .metric-icon { background: var(--accent-amber-light); color: var(--accent-amber); }
.metric-card.rose .metric-icon { background: var(--accent-rose-light); color: var(--accent-rose); }
.metric-card.indigo .metric-icon { background: var(--accent-indigo-light); color: var(--accent-indigo); }

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.trend-up { color: var(--accent-emerald); font-weight: 600; }
.trend-down { color: var(--accent-rose); font-weight: 600; }
.trend-label { color: var(--text-muted); }

/* Softphone Dialer Console */
.softphone-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(23, 34, 59, 0.9) 0%, rgba(11, 19, 41, 0.9) 100%);
    border: 1px solid var(--border-hover);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.softphone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.softphone-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
}

.status-dot.on-call { background: var(--accent-rose); box-shadow: 0 0 10px var(--accent-rose); }
.status-dot.wrapup { background: var(--accent-amber); box-shadow: 0 0 10px var(--accent-amber); }

.softphone-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .softphone-body { grid-template-columns: 1fr; }
}

.dialer-screen {
    background: rgba(11, 19, 41, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.caller-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.caller-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
}

.call-timer {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-emerald);
    font-family: monospace;
}

.dialpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    max-width: 260px;
    margin: 0 auto 1.25rem auto;
}

.dial-btn {
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dial-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-emerald);
    color: #fff;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Charts & Tables */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
}

.chart-card { padding: 1.5rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i { color: var(--accent-emerald); }

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.table-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
    overflow: hidden;
}

.table-responsive { overflow-x: auto; }

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.custom-table th {
    padding: 0.85rem 1rem;
    background: rgba(11, 19, 41, 0.7);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.custom-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-emerald { background: var(--accent-emerald-light); color: var(--accent-emerald); }
.badge-cyan { background: var(--accent-cyan-light); color: var(--accent-cyan); }
.badge-amber { background: var(--accent-amber-light); color: var(--accent-amber); }
.badge-rose { background: var(--accent-rose-light); color: var(--accent-rose); }
.badge-indigo { background: var(--accent-indigo-light); color: var(--accent-indigo); }

/* IVR Visual Flow Tree */
.ivr-tree-container {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ivr-node {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.75rem;
    min-width: 280px;
    text-align: center;
    position: relative;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.ivr-node.root {
    border-color: var(--accent-emerald);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
}

.ivr-line-v {
    width: 2px;
    height: 35px;
    background: var(--border-color);
    margin: 0 auto;
}

.ivr-branch-level {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-backdrop.active .modal-box { transform: scale(1); }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 1.15rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 1.5rem; }

.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    background: rgba(11, 19, 41, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .form-row { grid-template-columns: 1fr; }
}
