/* ==========================================================
   Modem Configuration Tool - Modern Glassmorphism Theme
   Designed for VPS & Desktop Web Deployment
   ========================================================== */

:root {
  --bg-primary: #0a0d14;
  --bg-surface: #111726;
  --bg-card: rgba(18, 26, 43, 0.82);
  --bg-card-hover: rgba(26, 37, 60, 0.95);
  --bg-input: #0e1422;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.45;
  font-size: 14px;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(6, 182, 212, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.font-mono {
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace !important;
}

.font-bold {
  font-weight: 700;
}

.text-cyan {
  color: var(--accent-cyan) !important;
}

.text-emerald {
  color: var(--accent-emerald) !important;
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 12px;
}

.highlight {
  color: #a5b4fc;
}

/* --- Layout --- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 24px 16px;
}

/* --- Top Global Header --- */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin: 12px 0;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-vps {
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* --- Navigation Tabs Bar --- */
.nav-tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.tab-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

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

.tab-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(6, 182, 212, 0.16);
  color: var(--accent-cyan);
  border-radius: 12px;
  letter-spacing: 0.3px;
}

/* --- Content Panes --- */
.main-content {
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}

.pane-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
}

.pane-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.bulk-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- Report Table (15 Items Single Page) --- */
.table-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.single-page-card {
  box-shadow: var(--shadow-md);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.report-table thead th {
  background: rgba(14, 20, 34, 0.85);
  padding: 9px 14px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.report-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 0.15s ease;
}

.report-table tbody tr:last-child {
  border-bottom: none;
}

.report-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.col-num {
  padding: 6px 14px;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-cyan);
  text-align: center;
}

.col-label {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.col-val {
  padding: 5px 12px;
}

.col-action {
  padding: 5px 14px;
  text-align: center;
}

/* Field Inputs (Editable in place) */
.field-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.field-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
  background: #121a2c;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 95px;
  height: 30px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
  color: #fff;
  transform: translateY(-1px);
}

.btn-copy.copied {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: var(--accent-emerald) !important;
  color: #34d399 !important;
}

/* Footer Tip Bar */
.footer-tip-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: #cbd5e1;
}

.footer-tip-bar kbd {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 11px;
}

/* --- Overview Cards Grid --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-icon {
  font-size: 20px;
}

.metric-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}

.data-row:last-child {
  border-bottom: none;
}

.data-key {
  color: var(--text-secondary);
}

.progress-wrap {
  margin-top: 14px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 4px;
}

/* --- WAN Connection Manager Tree --- */
.conn-mgr-tree {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(14, 20, 34, 0.9);
  border-bottom: 1px solid var(--border-subtle);
}

.profile-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.badge-priority {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border-radius: 12px;
}

.badge-active {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-radius: 4px;
}

.badge-standby {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-radius: 4px;
}

.device-list {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-item {
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.device-item.connected {
  border-left: 4px solid var(--accent-emerald);
}

.device-item.nosim {
  border-left: 4px solid var(--text-muted);
  opacity: 0.7;
}

.device-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.device-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}

.dot-online {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

.dot-gray {
  width: 8px;
  height: 8px;
  background: #64748b;
  border-radius: 50%;
}

.badge-status-green {
  font-size: 11px;
  padding: 2px 7px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-radius: 4px;
  font-weight: 600;
}

.badge-status-gray {
  font-size: 11px;
  padding: 2px 7px;
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border-radius: 4px;
  font-weight: 600;
}

.badge-tag {
  font-size: 10.5px;
  padding: 2px 6px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-radius: 3px;
  margin-left: 6px;
}

.device-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 16px;
  font-size: 12px;
}

/* Two-column layout */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

.card-subtitle-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(14, 20, 34, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 13px;
}

/* --- Raw API Console --- */
.raw-console-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.console-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

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

.flex-1 {
  flex: 1;
}

.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.json-viewer-wrap {
  background: #090c12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  max-height: 480px;
  overflow: auto;
}

.json-code {
  color: #38bdf8;
  font-size: 12.5px;
  line-height: 1.5;
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(14, 20, 34, 0.8);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 18px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.note-box {
  margin-top: 14px;
  padding: 10px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(14, 20, 34, 0.8);
  border-top: 1px solid var(--border-subtle);
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action .field-input {
  padding-right: 42px;
}

.btn-input-action {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-input-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Alert Box */
.alert-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  animation: slideToastIn 0.2s ease;
}

.alert-box.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.alert-box.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* Testing Progress Box */
.test-progress-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  animation: slideToastIn 0.2s ease;
}

.progress-spinner-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c7d2fe;
  font-size: 13.5px;
}

.progress-step-sub {
  margin-left: 32px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(99, 102, 241, 0.3);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

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

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 440px;
  padding: 12px 16px;
  background: rgba(18, 26, 43, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-emerald);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideToastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-icon {
  font-size: 16px;
}

.toast-msg {
  flex: 1;
}
