/* ============================================================
   Global Styles - Network Tool Client
   ============================================================ */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #334155;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
}

/* ============================================================
   App Layout
   ============================================================ */

.app-layout {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 200px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.user-email {
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent);
  color: white;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
}

.logout-btn {
  color: var(--danger) !important;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ============================================================
   Auth Pages
   ============================================================ */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-primary);
}

.auth-card {
  background: var(--bg-card);
  padding: 40px;
  border-radius: 12px;
  width: 400px;
  max-width: 90vw;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 8px;
}

.auth-card h2 {
  text-align: center;
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ============================================================
   Page
   ============================================================ */

.page h1 {
  font-size: 22px;
  margin-bottom: 20px;
}

/* ============================================================
   Card
   ============================================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  border-color: var(--accent);
}

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

.flex-input {
  flex: 1;
}

.small-input {
  width: 120px;
  flex: none;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn-primary {
  display: inline-block;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}

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

.btn-sm {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin-right: 4px;
}

.btn-sm:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-sm.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* ============================================================
   Status & Alerts
   ============================================================ */

.status-badge {
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 10px;
}

.status-badge.online {
  color: var(--success);
}

.status-badge.offline {
  color: var(--text-secondary);
}

.status-badge.busy {
  color: var(--warning);
}

.status-badge.success {
  color: var(--success);
}

.status-badge.failed {
  color: var(--danger);
}

.error-msg {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}

.success-msg {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}

.hint-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.empty-text {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

/* ============================================================
   Tables
   ============================================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 8px;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.data-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

.mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

/* ============================================================
   Load Bar
   ============================================================ */

.load-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.load-fill {
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s;
}

.load-bar span {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 35px;
}

/* ============================================================
   Connection
   ============================================================ */

.connection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.connection-header span {
  font-size: 15px;
}

.connection-header .btn-danger {
  padding: 6px 14px;
}

/* ============================================================
   Message Log
   ============================================================ */

.message-log {
  max-height: 350px;
  overflow-y: auto;
}

.message {
  padding: 6px 0;
  font-size: 13px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.msg-time {
  color: var(--text-secondary);
  font-size: 11px;
  min-width: 70px;
}

.msg-arrow {
  color: var(--accent);
  font-weight: bold;
}

.message.incoming .msg-arrow {
  color: var(--success);
}

.msg-text {
  word-break: break-all;
}

/* ============================================================
   Settings
   ============================================================ */

.settings-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  font-size: 14px;
}

.info-label {
  color: var(--text-secondary);
}
