:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --purple: #8b5cf6;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Outfit', sans-serif; }

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.container { width: 100%; max-width: 1200px; }

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

.logo { display: flex; align-items: center; gap: 12px; }
.logo h1 { font-size: 1.8rem; font-weight: 600; letter-spacing: -1px; }
.badge { font-size: 0.7rem; background: var(--primary); padding: 4px 8px; border-radius: 6px; vertical-align: middle; margin-left: 5px; }

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    font-size: 0.85rem;
}

.dot { width: 8px; height: 8px; background: var(--secondary); border-radius: 50%; }
.online .dot { background: var(--success); box-shadow: 0 0 10px var(--success); }

/* Common Components */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.hidden { display: none !important; }

/* Dashboard Overlay */
.dashboard-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.dashboard-container {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    background: #1e293b;
    border-radius: 30px;
    display: flex;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.dashboard-sidebar {
    width: 280px;
    background: #0f172a;
    padding: 30px;
    border-right: 1px solid var(--glass-border);
}

.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.close-dashboard { background: none; border: none; color: white; font-size: 2rem; cursor: pointer; }

.nav-btn {
    width: 100%;
    text-align: left;
    padding: 15px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: 0.2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-btn.active { background: var(--primary); color: white; }

.dashboard-content { flex: 1; padding: 40px; overflow-y: auto; background: #1e293b; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 30px; }
.stat-card { background: rgba(255,255,255,0.03); padding: 25px; border-radius: 20px; border: 1px solid var(--glass-border); }
.stat-card .label { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 10px; }
.stat-card .value { font-size: 2.5rem; font-weight: 600; }
.stat-card .value.purple { color: var(--purple); }

/* Tables */
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.table-scroll { overflow-x: auto; background: rgba(0,0,0,0.2); border-radius: 15px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 15px 20px; background: rgba(255,255,255,0.05); color: var(--text-muted); font-weight: 400; font-size: 0.85rem; }
td { padding: 15px 20px; border-top: 1px solid var(--glass-border); }

.role-badge { padding: 4px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 600; }
.role-badge.agent { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
.role-badge.customer { background: rgba(139, 92, 246, 0.2); color: var(--purple); }

.text-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.85rem; }

/* Forms */
.form-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 1100;
    display: flex; justify-content: center; align-items: center;
}
.form-card { background: #1e293b; padding: 40px; border-radius: 25px; width: 450px; border: 1px solid var(--glass-border); }
.form-grid { display: flex; flex-direction: column; gap: 15px; margin: 25px 0; }
.form-grid input, .form-grid select { 
    background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); 
    padding: 12px 15px; border-radius: 10px; color: white; font-size: 1rem;
}

/* Agent App Dashboard */
.agent-profile { display: flex; align-items: center; gap: 20px; margin-bottom: 30px; }
.avatar-container { position: relative; }
.avatar { width: 60px; height: 60px; background: var(--primary); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 600; }
.tags { display: flex; gap: 8px; margin-top: 5px; }
.tag { font-size: 0.7rem; padding: 3px 8px; border-radius: 6px; }
.tag.ext { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.tag.team { background: rgba(16, 185, 129, 0.1); color: var(--success); }

/* Lists */
.user-list-container { display: flex; flex-direction: column; gap: 25px; }
.list-section h4 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; list-style: none; }
.team-item { background: rgba(255,255,255,0.03); padding: 15px; border-radius: 18px; border: 1px solid var(--glass-border); display: flex; flex-direction: column; gap: 10px; }
.t-name { font-weight: 600; font-size: 0.9rem; }
.t-ext { font-size: 0.75rem; color: var(--primary); }
.group-call-btn { background: var(--primary); border: none; color: white; padding: 8px; border-radius: 10px; font-weight: 600; cursor: pointer; }

ul#user-list, ul#customer-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.user-item { background: rgba(255,255,255,0.03); padding: 12px 18px; border-radius: 18px; border: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center; }
.user-main { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 40px; height: 40px; background: #334155; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.user-meta { display: flex; flex-direction: column; }
.u-name { font-size: 0.95rem; font-weight: 600; }
.u-ext { font-size: 0.75rem; color: var(--text-muted); }

.call-icon { background: var(--success); border: none; width: 35px; height: 35px; border-radius: 50%; cursor: pointer; color: white; display: flex; align-items: center; justify-content: center; }

/* Call Screen */
.active-call { text-align: center; padding: 40px 0; }
.call-animation { position: relative; width: 120px; height: 120px; margin: 0 auto 30px; }
.caller-avatar { width: 120px; height: 120px; background: #334155; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3rem; position: relative; z-index: 5; border: 4px solid var(--bg-dark); }
.circle { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 2px solid var(--primary); border-radius: 50%; }
.pulse { animation: pulse 2s infinite; }
.delay-1 { animation-delay: 0.5s; }
.delay-2 { animation-delay: 1s; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }

.audio-visualizer { width: 100%; height: 60px; background: rgba(0,0,0,0.2); border-radius: 30px; margin: 30px 0; overflow: hidden; }
.v-bar { height: 100%; width: 0%; background: var(--success); transition: width 0.1s; }

.call-controls { display: flex; justify-content: center; gap: 20px; }
.primary-btn { background: var(--primary); color: white; border: none; padding: 12px 30px; border-radius: 12px; font-weight: 600; cursor: pointer; }
.secondary-btn { background: var(--secondary); color: white; border: none; padding: 12px 30px; border-radius: 12px; font-weight: 600; cursor: pointer; }
.danger-btn { background: var(--danger); color: white; border: none; width: 60px; height: 60px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transform: rotate(135deg); }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background: #1e293b; padding: 50px; border-radius: 30px; text-align: center; border: 1px solid var(--glass-border); width: 400px; }
.avatar.large { width: 100px; height: 100px; margin: 0 auto 20px; font-size: 2.5rem; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 30px; }
.success-btn { background: var(--success); color: white; border: none; padding: 12px; border-radius: 12px; font-weight: 600; cursor: pointer; }

/* Buttons & Utils */
.input-group { display: flex; flex-direction: column; gap: 20px; margin-top: 30px; }
input { background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); padding: 15px; border-radius: 12px; color: white; font-size: 1rem; }
.device-selector { font-size: 0.8rem; color: var(--text-muted); }
.device-selector select { background: none; border: none; color: var(--primary); cursor: pointer; outline: none; }
.admin-link { text-align: center; margin-top: 20px; }
.admin-link a { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; }
.admin-link a:hover { color: var(--primary); }
