:root {
  --bg-color: #050506;
  --panel-bg: #0c0c0e;
  --border-color: #1c1c21;
  --text-main: #f4f4f5;
  --text-muted: #71717a;
  --accent-orange: #d97706;
  --accent-orange-hover: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --input-bg: #121215;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 30px;
}

/* Background animated glow */
.background-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: 
    radial-gradient(ellipse at top, rgba(217, 119, 6, 0.04) 0%, transparent 60%), #050506;
  pointer-events: none;
}

.app-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.glass-header {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

.brand .icon {
  font-size: 24px;
}

.brand h1 {
  font-size: 19px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.green {
  background-color: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.status-dot.red {
  background-color: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 500px 1fr;
  gap: 24px;
}

@media (max-width: 1050px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.control-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* Widget Glass Cards */
.glass-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.widget-card {
  gap: 22px;
}

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

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

.glass-card h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

/* Inputs & Form Styling */
form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-select, .input-group input {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 11px 14px;
  font-family: inherit;
  color: #fff;
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 40px;
  cursor: pointer;
}

.form-select:focus, .input-group input:focus {
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.12);
}

.form-row.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row.align-center {
  align-items: center;
}

/* Custom Checkbox (Photo 1) */
.checkbox-group {
  margin: 6px 0;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 30px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  color: var(--text-main);
  font-weight: 500;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  height: 18px;
  width: 18px;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.2s;
}

.custom-checkbox:hover input ~ .checkmark {
  border-color: var(--accent-orange);
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--accent-orange);
  border-color: var(--accent-orange);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}

.custom-checkbox .checkmark:after {
  left: 6px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Switches (Photo 2 toggles) */
.setting-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.toggle-desc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-size: 14.5px;
  font-weight: 500;
  color: #fff;
}

.toggle-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--accent-orange);
  border-color: var(--accent-orange);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Accordions for Settings Sections */
.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.accordion-header {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.01);
}

.accordion-header:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.accordion-header .arrow {
  color: var(--text-muted);
  font-size: 11px;
  transition: transform 0.25s;
}

.accordion-item.open .accordion-header .arrow {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 16px 18px;
  border-top: 1px solid var(--border-color);
  flex-direction: column;
  gap: 16px;
}

.accordion-item.open .accordion-content {
  display: flex;
}

/* Outbound Proxy List widget styling */
.proxy-config-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px dashed var(--border-color);
  padding-top: 12px;
}

.proxy-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.proxy-actions {
  display: flex;
  gap: 8px;
}

.btn-proxy-test, .btn-proxy-edit {
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  background: var(--input-bg);
  color: #fff;
  transition: all 0.2s;
}

.btn-proxy-test {
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--accent-green);
}

.btn-proxy-test:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--accent-green);
}

.btn-proxy-edit {
  border-color: rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

.btn-proxy-edit:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
}

.proxy-config-area textarea {
  width: 100%;
  height: 140px;
  background-color: #0b090e;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: #a1a0a6;
  outline: none;
  resize: vertical;
  line-height: 1.5;
}

.proxy-config-area textarea:focus {
  border-color: var(--accent-orange);
}

.proxy-config-area textarea[readonly] {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Credentials Collapsible details */
.credentials-details {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.credentials-details summary {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  outline: none;
  color: var(--text-muted);
}

.credentials-details summary:hover {
  color: #fff;
}

.credentials-details .details-content {
  padding: 16px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 15px;
  width: 100%;
}

.btn-orange {
  background-color: var(--accent-orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  flex: 1;
  box-shadow: 0 4px 14px rgba(224, 112, 81, 0.3);
  transition: transform 0.1s, background-color 0.2s;
}

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

.btn-orange:active {
  transform: scale(0.98);
}

.btn-orange:disabled {
  background-color: #27262c;
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-stop {
  background-color: #ef4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  flex: 1;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
  transition: transform 0.1s, background-color 0.2s;
}

.btn-stop:hover {
  background-color: #f87171;
}

.btn-stop:active {
  transform: scale(0.98);
}

.btn-save-settings {
  background-color: #201f25;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}

.btn-save-settings:hover {
  background-color: #27262c;
  border-color: var(--accent-orange);
}

/* Logs Panel & Terminal */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.panel-header h2 {
  font-size: 18px;
  color: #fff;
}

.btn-clear {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-red);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-clear:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--accent-red);
}

.terminal-container {
  flex-grow: 1;
  background-color: #060508;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  height: 480px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.terminal {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: #e2e8f0;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 8px;
}

.terminal::-webkit-scrollbar {
  width: 6px;
}

.terminal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.terminal .line {
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal .system-line {
  color: var(--accent-orange);
}

.terminal .error-line {
  color: var(--accent-red);
}

.terminal .success-line {
  color: var(--accent-green);
}

.terminal .stderr-line {
  color: #b45309;
}

/* Accounts Table styling */
.accounts-section {
  margin-top: 10px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.section-header h2 {
  font-size: 18px;
  color: #fff;
}

.btn-secondary {
  background: #1c1a21;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--accent-orange);
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: rgba(255, 255, 255, 0.015);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.6px;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.loading-td {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-style: italic;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.ready {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-action {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-action:hover {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #fff;
  box-shadow: 0 0 10px rgba(224, 112, 81, 0.4);
}

/* Tabs Navigation Styling */
.nav-tabs {
  display: flex;
  gap: 8px;
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

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

.nav-tab.active {
  background: #18181b;
  border: 1px solid #27272a;
  color: #fff;
}

/* Setup Page Grid and Cards */
.setup-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 24px;
}

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

.info-guide {
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.info-guide h3 {
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--accent-orange);
}

.info-guide ol {
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.info-guide li {
  margin-bottom: 8px;
}

.code-container {
  background: #09080c;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  color: #a6accd;
  max-height: 350px;
  overflow-y: auto;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.55;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.form-inline {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 10px;
}

@media (max-width: 600px) {
  .form-inline {
    flex-direction: column;
    align-items: stretch;
  }
}

.form-inline .input-group {
  flex: 1;
}

.btn-setup {
  background: var(--accent-orange);
  border: 1px solid var(--accent-orange);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-setup:hover:not(:disabled) {
  background: var(--accent-orange-hover);
  border-color: var(--accent-orange-hover);
  box-shadow: 0 0 12px rgba(224, 112, 81, 0.4);
}

.btn-setup:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Red Badge for trash/delete */
.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Console logs */
.console-panel {
  background: #0d0b0f;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  font-family: 'Fira Code', monospace;
  height: 200px;
  overflow-y: auto;
  font-size: 12.5px;
  color: #a6accd;
  margin-top: 10px;
}

.console-panel .log-line {
  margin-bottom: 4px;
}

.console-panel .log-error {
  color: var(--accent-red);
}

.console-panel .log-success {
  color: var(--accent-green);
}

/* Syntax Highlighting Colors (Discord/Monokai/VS Code Style) */
.token-keyword { color: #f92672; font-weight: 600; }
.token-string { color: #e6db74; }
.token-comment { color: #75715e; font-style: italic; }
.token-builtin { color: #66d9ef; font-weight: 500; }
.token-function { color: #a6e22e; }
.token-number { color: #ae81ff; }

/* Custom Premium Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 5, 6, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card {
  background: #0c0c0e;
  border: 1px solid #27272a;
  border-radius: 12px;
  width: 90%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-title-icon {
  font-size: 20px;
}

.modal-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  letter-spacing: -0.2px;
}

.modal-body {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Global Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #1c1c21;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #27272a;
}
