/* =============================================================================
   VoIP NET1 Dashboard - Styles
   ============================================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0c10;
  --bg-elevated: #12151c;
  --card: #161a24;
  --card-hover: #1c2030;
  --border: #252a3a;
  --border-light: #2e3548;
  --text: #e8eaf0;
  --text-secondary: #9499ad;
  --text-muted: #6b7089;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.12);
  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, 0.12);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --transition: 150ms ease;
}

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

/* --- Login Page --- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  max-width: 100%;
  box-shadow: var(--shadow);
}
.login-box h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}
.login-box h1 span { color: var(--accent); }
.login-box p.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}
.login-error {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-error.visible { display: block; }

/* --- Header --- */
header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
header h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
header h1 span { color: var(--accent); }
.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--border);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.dot-red { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.dot-orange { background: var(--orange); }
.dot-pulse { animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Navigation Tabs --- */
.nav-tabs {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.nav-tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  user-select: none;
}
.nav-tab:hover { color: var(--text-secondary); }
.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Container --- */
.container { max-width: 1440px; margin: 0 auto; padding: 20px 24px; }

/* --- Tab panels --- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Stats --- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stat-cards { grid-template-columns: 1fr; } }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-light); }
.stat-card .label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.stat-card .value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.color-green { color: var(--green); }
.color-red { color: var(--red); }
.color-accent { color: var(--accent); }
.color-orange { color: var(--orange); }

/* --- Grid --- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 1000px) { .grid { grid-template-columns: 1fr; } }

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.card-body { padding: 0; }
.card-body-padded { padding: 18px; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
}
td {
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(59, 130, 246, 0.03); }

.table-scroll { max-height: 420px; overflow-y: auto; }
.table-scroll::-webkit-scrollbar { width: 4px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.badge-dot-green { background: var(--green); }
.badge-dot-red { background: var(--red); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #059669; color: white; }
.btn-success:hover { background: #047857; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
  border-radius: 8px;
}

.actions { display: flex; gap: 5px; }

/* --- Forms --- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-row { display: flex; gap: 10px; align-items: end; }
.form-row .form-group { flex: 1; margin-bottom: 0; }

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  width: 440px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modal-in 200ms ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* --- Empty state --- */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* --- Call direction --- */
.call-dir {
  font-size: 14px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.call-dir-in { background: var(--green-soft); color: var(--green); }
.call-dir-out { background: var(--accent-soft); color: var(--accent); }

/* --- User menu --- */
.user-menu {
  position: relative;
}
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.user-btn:hover { border-color: var(--border-light); }
.user-avatar {
  width: 24px; height: 24px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 200;
  overflow: hidden;
}
.dropdown.open { display: block; }
.dropdown-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
}
.dropdown-item:hover { background: var(--bg-elevated); color: var(--text); }
.dropdown-divider { border-top: 1px solid var(--border); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-soft); }

/* --- Trunk detail --- */
.trunk-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.trunk-field .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.trunk-field .value {
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  word-break: break-all;
}

/* --- Settings --- */
.settings-section {
  margin-bottom: 24px;
}
.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* --- Toast notifications --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: toast-in 200ms ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Docs */
.docs { line-height: 1.7; }
.docs p { color: var(--text-secondary); font-size: 14px; margin-bottom: 8px; }
.docs h3 { color: var(--text); font-size: 18px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.docs h4 { color: var(--text); font-size: 14px; margin-bottom: 8px; }
.docs-section { margin-bottom: 32px; }
.docs-section:last-child { margin-bottom: 0; }
.docs-methods { display: flex; flex-direction: column; gap: 16px; }
.docs-method { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.docs-code { background: #0d1017; border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; margin: 8px 0; overflow-x: auto; }
.docs-code pre { color: #c9d1d9; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12.5px; line-height: 1.6; white-space: pre; margin: 0; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.docs-table th { text-align: left; padding: 8px 12px; background: var(--bg); color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.docs-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.docs-table code { background: var(--accent-soft); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.docs-endpoint { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.docs-endpoint-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.docs-endpoint-header code { font-size: 14px; font-weight: 600; color: var(--text); }
.docs-endpoint details { margin-top: 8px; }
.docs-endpoint summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500; }
.docs-endpoint summary:hover { text-decoration: underline; }
.docs-list { padding-left: 20px; color: var(--text-secondary); font-size: 14px; }
.docs-list li { margin-bottom: 6px; }
.docs-list strong { color: var(--text); }

/* TTS history */
.call-dir-tts { color: var(--purple); font-size: 16px; }
.tts-toggle { cursor: pointer; font-size: 10px; vertical-align: middle; margin-left: 6px; transition: opacity 0.15s; }
.tts-toggle:hover { opacity: 0.8; }
.tts-toggle::after { content: ' \25BC'; font-size: 8px; }
.tts-toggle.open::after { content: ' \25B2'; }
.tts-msg { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease, padding 0.25s ease; font-size: 11px; color: var(--text-muted); font-style: italic; line-height: 1.4; padding: 0 8px; background: var(--bg); border-radius: 4px; border: 1px solid transparent; max-width: 300px; word-break: break-word; margin-top: 0; }
.tts-msg.open { max-height: 200px; opacity: 1; padding: 6px 8px; border-color: var(--border); margin-top: 4px; }

/* Voicemail */
.voicemail-list { display: flex; flex-direction: column; gap: 1px; }
.vm-item { padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.vm-item:hover { background: var(--card-hover); }
.vm-item:last-child { border-bottom: none; }
.vm-unread { border-left: 3px solid var(--accent); }
.vm-playing { background: var(--accent-soft); }
.vm-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.vm-info { display: flex; flex-direction: column; gap: 2px; }
.vm-caller { font-weight: 600; font-size: 14px; color: var(--text); }
.vm-meta { font-size: 12px; color: var(--text-muted); }
.vm-actions { display: flex; gap: 6px; flex-shrink: 0; }
.vm-player { overflow: hidden; }
.vm-player audio { border-radius: 6px; height: 36px; }
.vm-transcription { font-size: 13px; color: var(--text-secondary); margin-top: 6px; padding: 8px 10px; background: var(--bg); border-radius: 6px; border: 1px solid var(--border); line-height: 1.5; font-style: italic; }
