:root {
  --bg-base: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 52, 0.85);
  --bg-input: rgba(13, 18, 30, 0.8);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1.5rem;
  line-height: 1.5;
}

/* Ambient glow orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6366f1, transparent);
  top: -100px;
  right: -100px;
}
.orb-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #06b6d4, transparent);
  bottom: -150px;
  left: -100px;
}

.app-container {
  max-width: 1240px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.logo-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.engine-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  color: var(--text-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  transition: all 0.3s ease;
}

.status-badge.connected {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

/* Layout Grid */
.main-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Glassmorphic Cards */
.sidebar-card, .main-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.75rem;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Form inputs */
.form-row.two-cols {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.75rem;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.input-group input, .styled-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input-group input:focus, .styled-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-group.highlight-group input {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.05);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 2.75rem;
}

.toggle-pass-btn {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.toggle-pass-btn:hover {
  color: var(--text-main);
}

.engine-toggle-group {
  margin: 1.25rem 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--accent-primary);
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}

.checkbox-content strong {
  display: block;
  color: var(--text-main);
  margin-bottom: 2px;
}

.checkbox-content .text-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Toggles and options boxes */
.compression-toggle-box, .wipe-toggle-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.5rem;
}

.compression-toggle-box {
  border-left: 3px solid var(--accent-cyan);
}

.wipe-toggle-box {
  border-left: 3px solid var(--accent-warning);
}

.checkbox-label.warning-style strong {
  color: #fbbf24;
}

/* Server-side file picker */
.server-picker-box {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1.5rem;
}

.server-picker-box label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.65rem;
}

.server-picker-row {
  display: flex;
  gap: 0.75rem;
}

.styled-select {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
}

.styled-select option {
  background: #111827;
  color: white;
}

.divider-text {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.divider-text span {
  padding: 0 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
}

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

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-warning:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-large {
  padding: 0.95rem 1.6rem;
  font-size: 1rem;
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.w-full {
  width: 100%;
}

/* Connection Result Live Card */
.conn-result-box {
  margin-top: 1.25rem;
  padding: 1rem;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  animation: fadeIn 0.3s ease;
}

.conn-result-box.error {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.25);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 0.6rem;
}

.conn-result-box.error .result-header {
  color: #f87171;
}

.dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
}

.detail-row strong {
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  margin-bottom: 1.75rem;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: white;
  background: rgba(99, 102, 241, 0.15);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.4);
}

.count-pill {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
}

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

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

.panel-intro {
  margin-bottom: 1.5rem;
}

.panel-intro h3 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.panel-intro p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Backup summary card */
.backup-summary-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.summary-item .label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.summary-item .value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Alerts */
.alert-box {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-top: 1.5rem;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}

.alert-box.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-icon {
  width: 32px;
  height: 32px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.alert-content h4 {
  font-size: 1rem;
  color: #34d399;
  margin-bottom: 0.25rem;
}

.alert-content p {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.alert-actions {
  margin-top: 0.85rem;
}

/* Dropzone */
.dropzone-container {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  margin-bottom: 1.5rem;
}

.dropzone-container:hover, .dropzone-container.drag-over {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.06);
}

.file-input-hidden {
  display: none;
}

.dropzone-icon {
  color: var(--accent-cyan);
  margin-bottom: 0.75rem;
}

.dropzone-content h4 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.dropzone-content p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.file-limits {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* File Preview Card */
.file-preview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--accent-cyan);
}

.file-info strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.file-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-icon.danger {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  line-height: 1;
}

.btn-icon.danger:hover {
  color: var(--accent-danger);
}

/* Progress bar */
.progress-box {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.progress-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-bar-fill.indeterminate {
  width: 50%;
  position: absolute;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% { left: -50%; }
  100% { left: 100%; }
}

/* History Table */
.history-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.history-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
}

.history-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.history-table td.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.format-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
}

.format-badge.gz {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.format-badge.sql {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.text-right {
  text-align: right;
}

.table-actions {
  display: inline-flex;
  gap: 0.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
}

.toast {
  background: #1e293b;
  color: var(--text-main);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.86rem;
  animation: slideIn 0.3s ease;
  min-width: 280px;
  max-width: 420px;
}

.toast.success { border-left-color: var(--accent-success); }
.toast.error { border-left-color: var(--accent-danger); }
.toast.warning { border-left-color: var(--accent-warning); }

/* Confirmation Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.modal-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.6rem;
}

.modal-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.hidden {
  display: none !important;
}

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

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
