/**
 * PerseFone360 - Panel de Control
 * Centralita virtual con IA - Estilo profesional y tecnologico
 * CSS UNIFICADO para todas las pantallas admin
 */

/* =========================================
   VARIABLES CSS
   ========================================= */
:root {
    /* Colores principales - paleta profesional tech */
    --primary: #0f52ba;
    --primary-dark: #0a3d8f;
    --primary-light: #3b7dd8;
    --secondary: #0891b2;
    --accent: #06b6d4;

    /* Colores de estado */
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;

    /* Grises - ligeramente frios */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Alias de compatibilidad (usados por vistas legacy) */
    --dark: var(--gray-800);
    --gray: var(--gray-500);
    --light: var(--gray-100);
    --white: #ffffff;

    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-warning: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --gradient-danger: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    --gradient-info: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

    /* Espaciado */
    --sidebar-width: 256px;
    --header-height: 64px;

    /* Transiciones */
    --transition: all 0.15s ease;
}

/* =========================================
   RESET Y BASE
   ========================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* =========================================
   LAYOUT PRINCIPAL
   ========================================= */
.app-container,
.layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    transition: var(--transition);
}

.page-content {
    padding: 24px;
    padding-top: calc(var(--header-height) + 24px);
}

/* Page header - titulo + acciones */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.5rem;
    color: var(--gray-800);
}

/* Content grid - 2 columnas */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    height: 36px;
    width: auto;
}

.sidebar-logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-title {
    display: block;
    padding: 12px 24px 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 24px;
    color: var(--gray-400);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(15, 82, 186, 0.2);
    color: white;
    border-left-color: var(--accent);
}

.nav-item i,
.nav-item .icon {
    width: 20px;
    font-size: 0.95rem;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--gray-200);
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* =========================================
   HEADER
   ========================================= */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.header h2 {
    font-size: 1.5rem;
    color: var(--gray-800);
}

/* Fixed header variant */
.header-fixed {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    z-index: 90;
    transition: var(--transition);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    position: relative;
}

.header-search input {
    width: 300px;
    padding: 9px 16px 9px 40px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--gray-50);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.1);
    background: white;
}

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.875rem;
}

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

.header-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--gray-600);
}

.header-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.header-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--gray-50);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.user-role {
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* =========================================
   TARJETAS
   ========================================= */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

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

.card-header h3 {
    font-size: 1rem;
    color: var(--gray-800);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 14px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* =========================================
   STATS CARDS
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--gradient-primary); }
.stat-icon.success { background: var(--gradient-success); }
.stat-icon.warning { background: var(--gradient-warning); }
.stat-icon.danger { background: var(--gradient-danger); }
.stat-icon.info { background: var(--gradient-info); }

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 4px;
}

.stat-change.positive {
    color: var(--success);
    background: rgba(5, 150, 105, 0.08);
}

.stat-change.negative {
    color: var(--danger);
    background: rgba(220, 38, 38, 0.08);
}

.stat-change.neutral {
    color: var(--gray-500);
    background: var(--gray-100);
}

/* Variantes de color para stat-card */
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 0.85rem; color: var(--gray-500); margin-top: 4px; }
.stat-card.inbound .value { color: var(--success); }
.stat-card.outbound .value { color: var(--secondary); }
.stat-card.missed .value { color: var(--danger); }

/* =========================================
   BOTONES
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    filter: brightness(0.9);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    filter: brightness(0.9);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(0.9);
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

/* =========================================
   FORMULARIOS
   ========================================= */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.form-label .required {
    color: var(--danger);
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: var(--transition);
    background: white;
    color: var(--gray-800);
    font-family: inherit;
}

.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.1);
}

.form-control.error {
    border-color: var(--danger);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 6px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 6px;
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* =========================================
   ALERTAS
   ========================================= */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.alert-success {
    background: rgba(5, 150, 105, 0.08);
    color: #065f46;
    border-left: 3px solid var(--success);
}

.alert-danger,
.alert-error {
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    border-left: 3px solid var(--danger);
}

.alert-warning {
    background: rgba(217, 119, 6, 0.08);
    color: #92400e;
    border-left: 3px solid var(--warning);
}

.alert-info {
    background: rgba(2, 132, 199, 0.08);
    color: #075985;
    border-left: 3px solid var(--info);
}

/* =========================================
   TABLAS
   ========================================= */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td,
table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.table th,
table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
}

.table tbody tr:hover,
table tbody tr:hover,
table tr:hover {
    background: var(--gray-50);
}

.table .actions {
    display: flex;
    gap: 8px;
}

/* =========================================
   BADGES
   ========================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(2, 132, 199, 0.1);
    color: var(--info);
}

.badge-primary {
    background: rgba(15, 82, 186, 0.1);
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Status badges (pill variant) */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active,
.status-badge.assigned,
.badge.connected {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.status-badge.inactive,
.status-badge.unassigned,
.badge.disconnected {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

/* =========================================
   MODALES
   ========================================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--gray-800);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* =========================================
   FILTROS Y TABS
   ========================================= */
.filters-bar {
    background: white;
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.85rem;
}

.filter-tabs {
    display: flex;
    gap: 4px;
}

.filter-tab {
    padding: 8px 16px;
    border: none;
    background: var(--gray-100);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 500;
}

.filter-tab:hover {
    background: var(--gray-200);
}

.filter-tab.active {
    background: var(--primary);
    color: white;
}

/* Tabs generico */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab:hover {
    color: var(--gray-800);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

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

/* =========================================
   INFO BAR
   ========================================= */
.info-bar {
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* =========================================
   HELP TEXT / INFO BOX
   ========================================= */
.help-text {
    background: rgba(2, 132, 199, 0.06);
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 24px;
}

.help-text h4 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.help-text p {
    font-size: 0.85rem;
    color: var(--gray-700);
    line-height: 1.5;
}

/* =========================================
   PAGINACION
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px;
    border-top: 1px solid var(--gray-100);
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    color: var(--gray-700);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--gray-100);
}

.pagination .current {
    background: var(--primary);
    color: white;
}

.pagination .disabled {
    color: var(--gray-400);
    cursor: not-allowed;
}

/* =========================================
   EMPTY STATE
   ========================================= */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--gray-500);
}

.empty-state i,
.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
}

/* =========================================
   PHONE / MONOSPACE
   ========================================= */
.phone-number {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.duration {
    color: var(--gray-500);
    font-size: 0.8rem;
}

/* =========================================
   CALL DIRECTION & STATUS BADGES
   ========================================= */
.call-direction {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.call-direction.inbound { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.call-direction.outbound { background: rgba(2, 132, 199, 0.1); color: var(--info); }
.call-direction.internal { background: rgba(217, 119, 6, 0.1); color: var(--warning); }

.call-status { font-size: 0.75rem; font-weight: 500; }
.call-status.answered { color: var(--success); }
.call-status.missed { color: var(--danger); }
.call-status.busy { color: var(--warning); }
.call-status.failed { color: var(--gray-500); }

/* =========================================
   TOGGLE SWITCH
   ========================================= */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

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

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-300);
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-switch .slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .slider {
    background: var(--primary);
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* =========================================
   EXTENSION / AGENT ITEMS
   ========================================= */
.extension-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.extension-item:last-child {
    border-bottom: none;
}

.extension-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.extension-info { flex: 1; }
.extension-name { font-weight: 600; font-size: 0.9rem; color: var(--gray-800); }
.extension-number { font-size: 0.8rem; color: var(--gray-500); }

/* Extension/queue number badge */
.ext-number,
.queue-number,
.ivr-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 8px 12px;
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
}

.ext-number { background: var(--primary); }
.queue-number { background: var(--warning); }
.ivr-number { background: var(--secondary); }

/* Agent badges */
.agents-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--success);
    color: white;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
}

.agent-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.8;
}

.agent-remove:hover {
    opacity: 1;
}

/* Extension option (radio selector) */
.ext-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.ext-option:hover {
    border-color: var(--primary);
    background: rgba(15, 82, 186, 0.03);
}

.ext-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--gray-50);
}

.ext-option input[type="radio"] {
    margin-right: 10px;
}

.ext-option-number {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    margin-right: 10px;
}

/* =========================================
   QUICK ACTIONS
   ========================================= */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
    text-decoration: none;
    color: var(--gray-700);
    transition: var(--transition);
}

.quick-action:hover {
    background: var(--gray-100);
    transform: translateY(-2px);
}

.quick-action i {
    font-size: 1.25rem;
    color: var(--primary);
}

.quick-action span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* =========================================
   RECORDING BUTTON
   ========================================= */
.recording-btn {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: var(--transition);
}

.recording-btn:hover {
    filter: brightness(0.9);
}

/* =========================================
   WIZARD
   ========================================= */
.wizard {
    max-width: 800px;
    margin: 0 auto;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--gray-200);
    z-index: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.wizard-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 8px;
    transition: var(--transition);
}

.wizard-step.active .wizard-step-number {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(15, 82, 186, 0.15);
}

.wizard-step.completed .wizard-step-number {
    background: var(--success);
    color: white;
}

.wizard-step-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

.wizard-step.active .wizard-step-label {
    color: var(--primary);
    font-weight: 600;
}

.wizard-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.wizard-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.wizard-description {
    color: var(--gray-500);
    margin-bottom: 32px;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
}

/* =========================================
   LOGIN
   ========================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-900);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(15, 82, 186, 0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(8, 145, 178, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    height: 44px;
}

.login-logo h1 {
    font-size: 1.35rem;
    color: var(--gray-900);
    margin-top: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-title {
    text-align: center;
    margin-bottom: 28px;
}

.login-title h2 {
    font-size: 1.1rem;
    color: var(--gray-800);
    font-weight: 600;
}

.login-title p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* OTP Input */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    transition: var(--transition);
    color: var(--gray-900);
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 82, 186, 0.1);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        width: 256px;
    }

    .header-fixed {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

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

@media (max-width: 768px) {
    .stats-grid,
    .stats-row {
        grid-template-columns: 1fr;
    }

    .wizard-steps {
        flex-direction: column;
        gap: 16px;
    }

    .wizard-steps::before {
        display: none;
    }

    .header-search {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   ANIMACIONES
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.loading {
    animation: spin 1s linear infinite;
}

/* =========================================
   UTILITIES
   ========================================= */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

.hidden { display: none !important; }
