/* ============================================================
   Bản Đồ Sao Cá Nhân — style.css
   ============================================================ */

:root {
  --bg-from: #0e1e3a;
  --bg-to: #040b18;
  --card: rgba(10, 20, 42, 0.88);
  --card-border: rgba(120, 170, 255, 0.15);
  --line: #8bb9ff;
  --text: #e8f2ff;
  --muted: #8da8cc;
  --accent: #f5c842;
  --accent2: #7eb8ff;
  --danger: #ff8a8a;
  --green: #6fffa8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(30, 60, 130, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(10, 30, 80, 0.6) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(5, 12, 30, 1) 0%, #020810 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 32px 28px;
}

/* Stars background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 22%, rgba(255,255,255,0.55) 0%, transparent 100%),
    radial-gradient(1px 1px at 42% 8%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 68% 35%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 15%, rgba(255,255,255,0.45) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 55%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 55% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 10% 85%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 90%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 72% 90%, rgba(255,255,255,0.4) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.wrap, .full-width, section {
  position: relative;
  z-index: 1;
}

/* ── Page header ── */
.page-header {
  max-width: 1200px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245,200,66,0.22), rgba(126,184,255,0.18));
  border: 1px solid rgba(245,200,66,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.page-header-text h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  background: linear-gradient(135deg, #f5e8a0, #f5c842 40%, #ffe99a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header-text p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Layout ── */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 20px;
  align-items: start;
}

.card-sticky {
  position: sticky;
  top: 28px;
}

.full-width {
  max-width: 1200px;
  margin: 18px auto 0;
}

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 22px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.05) inset,
    0 20px 50px rgba(0, 0, 0, 0.45);
  transition: border-color 200ms ease;
}

.card:hover {
  border-color: rgba(120, 170, 255, 0.25);
}

.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
}

.muted { color: var(--muted); font-size: 0.875rem; }

/* ── Form fields ── */
.field {
  display: grid;
  gap: 5px;
  margin-bottom: 13px;
}

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input {
  border: 1px solid rgba(120, 170, 255, 0.2);
  background: rgba(4, 10, 25, 0.6);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:hover {
  border-color: rgba(120, 170, 255, 0.35);
  background: rgba(6, 14, 32, 0.7);
}

input:focus {
  border-color: rgba(126, 184, 255, 0.6);
  outline: none;
  box-shadow: 0 0 0 3px rgba(100, 155, 230, 0.15);
  background: rgba(6, 14, 32, 0.75);
}

textarea, select {
  border: 1px solid rgba(120, 170, 255, 0.2);
  background: rgba(4, 10, 25, 0.6);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus, select:focus {
  border-color: rgba(126, 184, 255, 0.6);
  outline: none;
  box-shadow: 0 0 0 3px rgba(100, 155, 230, 0.15);
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.coord-row input {
  width: 100%;
  font-size: 0.88rem;
  padding: 9px 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.coord-row .field {
  overflow: hidden;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120,170,255,0.2), transparent);
  margin: 14px 0;
}

/* ── Buttons ── */
button {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  letter-spacing: 0.02em;
  transition: opacity 150ms ease, transform 100ms ease, box-shadow 150ms ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary {
  color: var(--text);
  background: linear-gradient(180deg, rgba(40, 78, 130, 0.9), rgba(26, 52, 95, 0.95));
  border: 1px solid rgba(120, 170, 255, 0.25);
}

.secondary:hover:not(:disabled) {
  box-shadow: 0 4px 18px rgba(60, 110, 200, 0.3);
  border-color: rgba(120, 170, 255, 0.45);
}

.primary {
  color: #16180f;
  background: linear-gradient(160deg, #ffe178, #f5c030 50%, #e8aa10);
  box-shadow: 0 4px 20px rgba(245, 192, 48, 0.25);
}

.primary:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(245, 192, 48, 0.45);
  background: linear-gradient(160deg, #ffe97a, #f7ca38 50%, #eab520);
}

/* ── Status ── */
#status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 200ms ease;
}

#status:not(:empty) {
  background: rgba(4, 10, 25, 0.5);
  border: 1px solid rgba(120,170,255,0.1);
}

#status.error {
  color: var(--danger);
  background: rgba(255, 50, 50, 0.08);
  border-color: rgba(255, 100, 100, 0.2);
}

/* ── Result grid ── */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  grid-template-rows: auto auto;
  gap: 16px;
}

.side-panels {
  display: grid;
  gap: 12px;
  align-content: start;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bottom-panels {
  grid-column: 1 / -1;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(120,170,255,0.15);
}

canvas {
  width: 100%;
  background: rgba(2, 6, 16, 0.7);
  border-radius: 14px;
  border: 1px solid rgba(120, 170, 255, 0.18);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(120, 170, 255, 0.1);
  text-align: left;
  vertical-align: top;
}

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

tr:hover td {
  background: rgba(120,170,255,0.04);
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-bottom: 8px;
}

/* ── Meta info box ── */
.meta {
  margin-bottom: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  background: rgba(4, 10, 25, 0.55);
  border: 1px solid rgba(120,170,255,0.12);
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.65;
}

.meta b {
  color: rgba(200, 225, 255, 0.85);
  font-weight: 500;
}

/* ── AI section ── */
.ai-config-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-card {
  padding: 14px 16px;
  border: 1px solid rgba(120, 170, 255, 0.15);
  border-radius: 13px;
  background: rgba(4, 10, 25, 0.5);
}

.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  margin-top: 8px;
}

.topic-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  padding: 4px 8px;
  border-radius: 7px;
  transition: background 150ms ease;
}

.topic-grid label:hover {
  background: rgba(120,170,255,0.08);
}

.topic-grid input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  box-shadow: none;
  border-radius: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.ai-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

#aiOutput {
  margin-top: 0;
  max-height: 720px;
  overflow: auto;
  white-space: normal;
  font-size: 0.97rem;
  line-height: 1.8;
  color: var(--text);
  padding: 16px 18px;
}

#aiOutput h3, #aiOutput h4 {
  margin: 16px 0 8px;
  color: #f8d98d;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
}

#aiOutput p {
  margin: 0 0 12px;
}

#aiOutput ul {
  margin: 0 0 12px 18px;
  padding: 0;
}

#aiOutput li {
  margin-bottom: 8px;
}

#aiOutput strong {
  color: #ffe39f;
  font-weight: 700;
}

#aiOutput em {
  color: #a8ccf5;
  font-style: italic;
}

.ai-result-title {
  font-family: 'Cormorant Garamond', serif;
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f7d992;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-result-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
}

.is-hidden {
  display: none !important;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(4,10,25,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: rgba(120,170,255,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,170,255,0.4); }

/* ── Responsive ── */
@media (max-width: 980px) {
  body { padding: 18px 14px; }
  .wrap { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .two-cols { grid-template-columns: 1fr; }
  .bottom-panels { grid-column: auto; }
  .ai-config-grid { grid-template-columns: 1fr; }
}
