:root {
  --bg-dark: #08080a;
  --card-bg: rgba(22, 22, 26, 0.95);
  --accent-red: #ff3b30;
  --accent-blue: #0052ff;
  --accent-cyan: #00d4ff;
  --text-muted: #e9e9e9;
  --border-color: #333;
  --glow-red: rgba(255, 59, 48, 0.3);
  --glow-blue: rgba(0, 82, 255, 0.3);
}

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

body {
  background: var(--bg-dark);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 59, 48, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(0, 82, 255, 0.05) 0%, transparent 20%);
  color: #ffffff;
  padding: 12px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  min-height: 100vh;
  padding-bottom: 80px;
}

.container-main {
  max-width: 1000px;
  margin: 20px auto;
}

.terminal-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.terminal-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-red), var(--accent-blue), transparent);
}

.terminal-header {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-header h2 {
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(to right, #ff3b30, #ff807a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  font-size: 20px;
}

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

.btn-logout {
  background: transparent;
  border: 1px solid #444;
  color: #888;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-logout:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.tech-info-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #ffffff;
  margin-top: 16px;
  padding: 0 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

.tabs-container {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid #333;
  padding-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  white-space: nowrap;
  font-family: inherit;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
}

.tab-content {
  display: none;
}

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

.input-group-custom {
  background: #1a1a1e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 5px;
  transition: all 0.3s ease;
}

.input-group-custom:focus-within {
  border-color: var(--accent-red);
  box-shadow: 0 0 15px var(--glow-red);
}

.form-control, .form-select {
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  font-weight: bold;
  box-shadow: none !important;
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
}

.form-control::placeholder { color: #555; }

.form-select option {
  background: #1a1a1e;
  color: #ffffff;
  padding: 10px;
}

.btn-scan {
  background: var(--accent-red);
  border: none;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 4px;
  padding: 14px 16px;
  margin-top: 10px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  color: #ffffff;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.btn-scan:hover:not(:disabled) {
  background: #ff4d43;
  box-shadow: 0 0 30px var(--glow-red);
  transform: translateY(-2px);
}

.btn-scan:disabled {
  background: #444;
  opacity: 0.7;
  color: #ffffff;
  cursor: not-allowed;
}

.btn-secondary {
  background: #2a2a2e;
  border: 1px solid #444;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #3a3a3e;
  border-color: var(--accent-red);
}

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

.small { font-size: 12px; }

.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.me-2 { margin-right: 8px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.p-3 { padding: 12px; }

.row { display: flex; flex-wrap: wrap; }
.row.g-2 { gap: 8px; }
.row.g-3 { gap: 12px; }
.col-4 { width: calc(33.33% - 6px); }
.col-6 { width: calc(50% - 6px); }
.col-md-6 { width: 100%; }
.col-md-3 { width: 100%; }

@media (min-width: 600px) {
  .col-md-6 { width: calc(50% - 6px); }
  .col-md-3 { width: calc(25% - 9px); }
}

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.border-top { border-top: 1px solid #333; }
.border-bottom { border-bottom: 1px solid #333; }
.border-secondary { border-color: #444; }
.pt-2 { padding-top: 8px; }
.pb-2 { padding-bottom: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }

#reasoning-container {
  margin-top: 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #222;
}

#reasoning-header {
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

#reasoning-header:hover { color: #aaa; background: rgba(255,255,255,0.02); }

#reasoning-content {
  padding: 16px;
  color: #777;
  font-size: 13px;
  line-height: 1.6;
  display: block;
  border-top: 1px solid #222;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.result-box {
  background: linear-gradient(145deg, #0a0a0c, #111);
  border-left: 4px solid var(--accent-blue);
  padding: 20px;
  border-radius: 4px 12px 12px 4px;
  margin-top: 20px;
  color: #e0e0e0;
  line-height: 1.7;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-x: hidden;
}

.result-box::after {
  content: "ANALYSIS_COMPLETE";
  position: absolute;
  top: 10px; right: 15px;
  font-size: 10px;
  color: #333;
  letter-spacing: 1px;
}

.result-box h2, .result-box h3 {
  color: var(--accent-red);
  margin-top: 16px;
  margin-bottom: 12px;
  font-size: 1.1rem;
  border-bottom: 1px solid #222;
  padding-bottom: 6px;
}

.result-box strong { color: var(--accent-cyan); }
.result-box ul { padding-left: 20px; }
.result-box code { background: #222; color: var(--accent-red); padding: 2px 5px; border-radius: 4px; }

.loader-wrapper {
  display: none;
  text-align: center;
  margin: 30px 0;
}

.cyber-loader {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 59, 48, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-red);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 12px;
}

.loader-text {
  color: var(--accent-red);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: blink 1.5s infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.radar-item {
  background: #1a1a1a;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #222;
  transition: 0.2s;
  position: relative;
  cursor: pointer;
}

.radar-item:hover {
  border-color: #444;
}

.radar-remove {
  position: absolute;
  top: 2px; right: 2px;
  background: transparent;
  border: none;
  color: #666;
  font-size: 12px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.radar-symbol {
  font-size: 11px;
  color: #888;
  padding-right: 12px;
}

.radar-price {
  font-weight: bold;
  color: #fff;
  font-size: 14px;
  font-family: 'JetBrains Mono';
}

.radar-change {
  font-size: 11px;
  font-weight: bold;
}

.signal-item {
  background: #1a1a1e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.signal-item:hover {
  border-color: #555;
}

.signal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.signal-symbol {
  color: var(--accent-cyan);
  font-weight: bold;
  font-size: 14px;
}

.signal-rating {
  font-size: 12px;
}

.signal-time {
  color: #666;
  font-size: 11px;
}

.signal-body {
  color: #999;
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.signal-item.expanded .signal-body {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.empty-state {
  text-align: center;
  color: #555;
  padding: 40px 0;
  font-size: 14px;
}

.setting-group {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #222;
}

.setting-group:last-child {
  border-bottom: none;
}

.setting-label {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
  display: block;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.setting-row span {
  font-size: 13px;
  color: #ccc;
}

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

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #333;
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-red);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.setting-input {
  background: #1a1a1e;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.setting-input:focus {
  border-color: var(--accent-red);
}

.setting-select {
  background: #1a1a1e;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
}

.setting-select option {
  background: #1a1a1e;
  color: #fff;
}

.btn-save {
  background: var(--accent-red);
  border: none;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s;
}

.btn-save:hover {
  background: #ff4d43;
  box-shadow: 0 0 20px var(--glow-red);
}

.toast {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9999;
  animation: toastIn 0.3s ease;
}

.toast.success {
  background: #1a3a1a;
  border: 1px solid #2ecc71;
  color: #2ecc71;
}

.toast.error {
  background: #3a1a1a;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
  .terminal-card { padding: 16px 12px; }
  body { padding: 8px; padding-bottom: 70px; }
  .result-box { padding: 12px; font-size: 13px; }
  .result-box h2, .result-box h3 { font-size: 1rem; }
  .tab-btn { font-size: 12px; padding: 8px 12px; }
}

@media (min-width: 768px) {
  .terminal-card { padding: 40px; }
}
