/* ============================================================
   JJR GROUP — Design System
   Sistema de Telefonía VoIP
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Variables modo claro ── */
:root {
  --font: 'Inter', system-ui, sans-serif;

  /* Brand */
  --brand-50:  #EFF6FF;
  --brand-100: #DBEAFE;
  --brand-200: #BFDBFE;
  --brand-300: #93C5FD;
  --brand-400: #60A5FA;
  --brand-500: #3B82F6;
  --brand-600: #2563EB;
  --brand-700: #1D4ED8;
  --brand-800: #1E40AF;
  --brand-900: #1E3A8A;

  /* Surfaces */
  --bg:          #F1F5F9;
  --surface:     #FFFFFF;
  --surface-2:   #F8FAFC;
  --surface-3:   #F1F5F9;
  --border:      #E2E8F0;
  --border-2:    #CBD5E1;

  /* Text */
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-inverse:   #FFFFFF;

  /* Status */
  --green:      #10B981;
  --green-bg:   #ECFDF5;
  --green-text: #065F46;
  --red:        #EF4444;
  --red-bg:     #FEF2F2;
  --red-text:   #991B1B;
  --yellow:     #F59E0B;
  --yellow-bg:  #FFFBEB;
  --yellow-text:#92400E;
  --blue:       #3B82F6;
  --blue-bg:    #EFF6FF;
  --blue-text:  #1E40AF;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);

  /* Radii */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Sidebar */
  --sidebar-w: 240px;
  --topbar-h:  60px;

  /* Transitions */
  --t: .18s ease;
}

/* ── Variables modo oscuro ── */
[data-theme="dark"] {
  --bg:          #0F172A;
  --surface:     #1E293B;
  --surface-2:   #263144;
  --surface-3:   #2D3A50;
  --border:      #334155;
  --border-2:    #475569;

  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #64748B;
  --text-inverse:   #0F172A;

  --green-bg:   #064E3B;
  --green-text: #6EE7B7;
  --red-bg:     #450A0A;
  --red-text:   #FCA5A5;
  --yellow-bg:  #451A03;
  --yellow-text:#FDE68A;
  --blue-bg:    #1E3A8A;
  --blue-text:  #93C5FD;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.4);
  --shadow-xl: 0 20px 25px rgba(0,0,0,.5);
}

/* ── Reset base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background var(--t), color var(--t);
}

/* ── Utilitarios globales ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: none;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand-600);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-icon {
  padding: 8px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text-primary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 500;
}
.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow-text); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-text); }
.badge-gray   { background: var(--surface-3); color: var(--text-secondary); }

/* ── Theme toggle button ── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all var(--t);
}
.theme-toggle:hover { background: var(--surface-3); color: var(--text-primary); }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Dot de estado ── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.connected    { background: var(--green); box-shadow: 0 0 0 2px var(--green-bg); }
.status-dot.disconnected { background: var(--red);   box-shadow: 0 0 0 2px var(--red-bg); }
.status-dot.ringing      { background: var(--yellow); box-shadow: 0 0 0 2px var(--yellow-bg); animation: pulse 1s infinite; }
.status-dot.busy         { background: var(--red);   box-shadow: 0 0 0 2px var(--red-bg); animation: pulse .6s infinite; }

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

/* ── Input base ── */
.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: .875rem;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
}
.input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.input::placeholder { color: var(--text-muted); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
