/* Tuệ Trading Signal Alert — Mini App styles
 * Match screenshot: green-emerald primary, white card, rounded chips.
 */

:root {
  --bg: #f5f3ee;
  --card-bg: #ffffff;
  --primary: #2f6f56;
  --primary-dark: #265a45;
  --primary-light: #e8f1ec;
  --danger: #b94a48;
  --text: #1f2a26;
  --text-muted: #6b7c75;
  --border: #d8d4c9;
  --chip-bg: #ffffff;
  --chip-bg-active: var(--primary);
  --chip-text-active: #ffffff;
  --shadow: 0 4px 16px rgba(47, 111, 86, 0.08);
  --radius: 12px;
  --radius-chip: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.2px;
}

.icon-btn {
  background: transparent;
  border: 0;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

main { padding: 0 20px 32px; }

h2 { margin: 8px 0 12px; font-size: 17px; font-weight: 700; }
h3 { margin: 4px 0 14px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.conditions-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.condition-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.12s ease;
}
.condition-card:active { transform: scale(0.99); }

.condition-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.condition-body { flex: 1; min-width: 0; }
.condition-title { font-weight: 600; font-size: 15px; color: var(--text); margin: 0 0 2px; }
.condition-subtitle { font-size: 13px; color: var(--text-muted); margin: 0; }
.condition-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-chip);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}
.condition-tag.disabled { background: #eee; color: #999; }

.primary-btn {
  width: 100%;
  background: var(--primary);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}
.primary-btn:hover { background: var(--primary-dark); }
.primary-btn:disabled { background: #b8c4be; cursor: not-allowed; }

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.danger-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.error-banner {
  background: #fdecea;
  color: #8a2a25;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 13px;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 20, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: 18px 18px 0 0;
  padding: 18px 18px 24px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.18s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-header h2 { margin: 0; font-size: 17px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.field input, .field select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px;
  font-size: 15px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--primary); }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  background: var(--chip-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.chip.active {
  background: var(--chip-bg-active);
  color: var(--chip-text-active);
  border-color: var(--chip-bg-active);
}
.chip.disabled { opacity: 0.5; cursor: not-allowed; }
.hint { color: var(--text-muted); font-size: 12px; }
.indicator-info { color: var(--text-muted); font-size: 12px; margin: 0; }

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 10px;
}
.form-actions-right { display: flex; gap: 10px; flex: 1; justify-content: flex-end; }

.hidden { display: none !important; }
