/* OmniFlow Premium Styling & Theme Tokens */
:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Midnight Cyber Theme (Default Dark) */
  --bg-gradient: linear-gradient(135deg, #06040d 0%, #0a0717 50%, #11091f 100%);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-border-active: rgba(147, 51, 234, 0.4);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-muted: rgba(255, 255, 255, 0.45);
  --accent: #a78bfa;
  --accent-glow: rgba(167, 139, 250, 0.25);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger: #f43f5e;
  --btn-bg: rgba(255, 255, 255, 0.05);
  --btn-hover: rgba(255, 255, 255, 0.1);
  --shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
  --input-bg: rgba(0, 0, 0, 0.25);
  --scroll-thumb: rgba(167, 139, 250, 0.2);
}

/* Polar Dream Theme (Light Mode) - High Contrast & Prominent */
body.light-mode {
  --bg-gradient: linear-gradient(135deg, #f3f0fd 0%, #e8e3f9 50%, #dbd4f7 100%);
  --card-bg: #ffffff;
  --card-border: rgba(139, 92, 246, 0.18);
  --card-border-active: rgba(139, 92, 246, 0.6);
  --text-primary: #120e36;
  --text-secondary: #2c2560;
  --text-muted: #5e5792;
  --accent: #7c3aed;
  --accent-glow: rgba(124, 58, 237, 0.15);
  --success: #059669;
  --success-glow: rgba(5, 150, 105, 0.15);
  --danger: #dc2626;
  --btn-bg: rgba(124, 58, 237, 0.06);
  --btn-hover: rgba(124, 58, 237, 0.12);
  --shadow: 0 8px 30px 0 rgba(124, 58, 237, 0.08);
  --input-bg: #fbfbfe;
  --scroll-thumb: rgba(124, 58, 237, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

html {
  overflow: hidden;
  width: 400px;
  height: 600px;
}

body {
  width: 400px;
  height: 600px;
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Enforced OS Standalone Window Mode Overrides */
html.window-mode-active, body.window-mode-active {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

.container {
  width: 100%;
  height: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

/* Header Styles */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.3);
}

.logo-text {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-mode .logo-text {
  background: linear-gradient(135deg, #6d28d9 0%, #db2777 100%);
  -webkit-background-clip: text;
}

/* Header Action Buttons Component */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
  color: var(--text-primary);
  background: var(--btn-hover);
  transform: scale(1.08);
}

.action-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

/* Scroll Container */
.content-scroll {
  flex: 1;
  min-height: 0; /* Force flex child to respect parent container height limits, triggering scrollbar */
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}

.content-scroll::-webkit-scrollbar {
  width: 4px;
}

.content-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.content-scroll::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb);
  border-radius: 10px;
}

/* Card layout */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-header h4 {
  font-size: 14.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.card-description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 8px;
  padding-left: 2px;
}

.header-icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.justify-between {
  justify-content: space-between;
}

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

/* Toggle Rows Custom Design */
.toggle-row {
  padding: 6px 0;
}

.toggle-meta {
  flex: 1;
  padding-right: 12px;
}

.toggle-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 1px;
}

.border-top {
  border-top: 1px solid var(--card-border);
}

.pt-10 {
  padding-top: 10px;
}

/* Proxy Type Radio Pill */
.type-selection {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.radio-pill {
  flex: 1;
  cursor: pointer;
  position: relative;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-pill span {
  display: block;
  text-align: center;
  padding: 6px 0;
  background: var(--btn-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.radio-pill input:checked + span {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

body.light-mode .radio-pill input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Grid Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
}

.col-8 { grid-column: span 8; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }

.input-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 2px;
}

.input-field input {
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-family);
  font-size: 15.5px;
  outline: none;
  font-weight: 500;
}

.input-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

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

.relative {
  position: relative;
}

.pass-wrapper {
  position: relative;
  display: flex;
}

.pass-wrapper input {
  width: 100%;
  padding-right: 32px;
}

#togglePassBtn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px;
}

#togglePassBtn:hover {
  color: var(--text-primary);
}

/* Toggle Switch Component */
.switch-container {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--btn-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  transition: .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  transition: .2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-mode .switch-slider:before {
  background-color: #ffffff;
}

.switch-container input:checked + .switch-slider {
  background-color: var(--success);
  border-color: var(--success);
}

.switch-container input:checked + .switch-slider:before {
  transform: translateX(16px);
  background-color: #ffffff;
}

/* Buttons */
.primary-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #06040d;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 15.5px;
  padding: 10px 0;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-mode .primary-btn {
  color: #ffffff;
}

/* Outline Button Styling */
.outline-btn {
  background: var(--btn-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 14.5px;
  padding: 10px 0;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: all 0.2s ease;
}

.outline-btn:hover {
  background: var(--btn-hover);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

body.light-mode .outline-btn {
  background: #f3effe;
  border-color: var(--card-border);
  color: var(--accent);
}

body.light-mode .outline-btn:hover {
  background: #ede6ff;
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

.glow-btn {
  box-shadow: 0 4px 15px var(--accent-glow);
}

.glow-btn:hover {
  background: #b59ffb;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

body.light-mode .glow-btn:hover {
  background: #6d28d9;
}

.icon-svg {
  width: 14px;
  height: 14px;
}

/* Spinner Animation */
.loading-spinner {
  width: 14px;
  height: 14px;
  animation: spin 0.8s linear infinite;
  color: var(--accent);
}

.hidden {
  display: none !important;
}

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

/* Status Panel */
.status-panel {
  display: flex;
  flex-direction: column; /* Stack vertically for compact 400px dropdown popup to prevent squishing */
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  width: 100%; /* Take full horizontal width to give IP/Port and Timezone plenty of breathing room */
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 4px var(--text-muted);
}

.dot.active {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.dot.warning {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

.status-lbl {
  color: var(--text-muted);
  text-transform: uppercase;
}

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

/* Util Margin Classes */
.margin-top { margin-top: 8px; }
.margin-bottom { margin-bottom: 8px; }
.align-center { text-align: center; }

/* ========================================================
   LIVE DIAGNOSTIC CARD STYLING
   ======================================================== */
.diag-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--input-bg);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--card-border);
  margin-top: 4px;
}

.diag-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

body.light-mode .diag-item {
  border-bottom-color: rgba(139, 92, 246, 0.05);
}

.diag-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.diag-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.diag-value {
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 14.5px;
}

.diag-value.success {
  color: var(--success);
  text-shadow: 0 0 6px var(--success-glow);
}

.diag-value.warning {
  color: var(--danger);
}

.diag-value.info {
  color: var(--accent);
}

.action-btn-small {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}

.action-btn-small:hover {
  background: var(--btn-hover);
  color: var(--text-primary);
}

.btn-small {
  padding: 8px 0;
  font-size: 11px;
}

/* ========================================================
   RESPONSIVE DESIGN SYSTEM: Standalone Desktop Panel Mode
   ======================================================== */
@media (min-width: 640px) {
  /* When standalone window is dragged wider, transform into a 2-column SaaS Dashboard! */
  body.window-mode-active .content-scroll {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr; /* Left panel is slightly wider for input layouts */
    gap: 16px;
    align-items: start;
  }
  
  /* Symmetrical 2x2 dashboard layout grid. Let Card 3 and Card 4 sit side-by-side naturally! */
  body.window-mode-active .glass-card {
    margin-bottom: 0;
    height: 100%;
  }

  body.window-mode-active .container {
    padding: 20px 24px;
  }

  body.window-mode-active footer {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
  }

  body.window-mode-active .status-panel {
    flex-direction: row; /* Horizontal row layout for the wide desktop window mode! */
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 0;
    padding: 10px 16px;
    height: 100%;
    align-items: center;
  }

  body.window-mode-active .status-item {
    width: auto;
    max-width: 48%;
  }

  body.window-mode-active .primary-btn {
    padding: 12px 32px;
    width: auto;
  }
}

/* ========================================================
   智能一键解析区美化与动效 (Aesthetic glassmorphism & transitions)
   ======================================================== */
.smart-parse-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

body.light-mode .smart-parse-container {
  background: rgba(124, 58, 237, 0.03);
}

.smart-parse-container:focus-within {
  border-color: var(--accent);
  background: rgba(147, 51, 234, 0.02);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.05);
}

body.light-mode .smart-parse-container:focus-within {
  background: rgba(124, 58, 237, 0.06);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.05);
}

.smart-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.smart-tag {
  font-size: 9px !important;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: none !important;
  letter-spacing: 0px !important;
  font-weight: 700;
}

.smart-input-wrapper {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.smart-input-wrapper input {
  flex: 1;
  min-width: 0;
  font-size: 13.5px !important;
}

.smart-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #06040d;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 12.5px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

body.light-mode .smart-btn {
  color: #ffffff;
}

.smart-btn:hover {
  background: #b59ffb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

body.light-mode .smart-btn:hover {
  background: #6d28d9;
}

.smart-btn:active {
  transform: translateY(0);
}

