@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=DM+Sans:wght@300;400;500;700&display=swap');

:root {
  --obsidian: #0d0d0f;
  --charcoal: #1a1a1e;
  --ink: #252528;
  --silver: #a8a8b3;
  --pearl: #e8e8ed;
  --cream: #f5f0e8;
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --amber: #d4862a;
  --lens: #4a9eff;
  --up: #4caf7d;
  --down: #e05a5a;
  --unknown: #8a8a94;
  --nav-bg: rgba(13,13,15,0.92);
  --error-text: #ff9d9d;
  --shadow: rgba(0,0,0,0.4);
}

:root[data-theme="light"] {
  --obsidian: #f6f4ee;
  --charcoal: #ffffff;
  --ink: #f0ede3;
  --silver: #68666f;
  --pearl: #201f24;
  --gold: #b3892f;
  --gold-light: #8a6a1f;
  --amber: #a85f1c;
  --lens: #2f6fce;
  --up: #2f8f5c;
  --down: #c23a3a;
  --unknown: #6d6b76;
  --nav-bg: rgba(255,255,255,0.92);
  --error-text: #a12525;
  --shadow: rgba(20,15,5,0.12);
}

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

html, body {
  height: 100%;
}

body {
  background: var(--obsidian);
  font-family: 'DM Sans', sans-serif;
  color: var(--pearl);
}

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3 { font-family: 'Playfair Display', serif; font-weight: 700; color: var(--pearl); }

/* ---- NAV ---- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 64px;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(201,168,76,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 0.92rem; }
.nav-user { color: var(--silver); }
.nav-logout { color: var(--down); }

.page { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }

/* ---- CARDS / PANELS ---- */
.panel {
  background: var(--charcoal);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: 10px;
  padding: 28px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.target-card {
  background: var(--charcoal);
  border: 1px solid rgba(201,168,76,0.15);
  border-left: 4px solid var(--unknown);
  border-radius: 8px;
  padding: 18px 20px;
  transition: border-color 0.2s ease, opacity 0.15s ease;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.target-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.target-card.status-up { border-left-color: var(--up); }
.target-card.status-down { border-left-color: var(--down); }
.target-card.status-unknown { border-left-color: var(--unknown); }

.target-card .row1 { display: flex; justify-content: space-between; align-items: center; }
.target-card h3 { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 1.05rem; color: var(--pearl); }
.target-card .meta { color: var(--silver); font-size: 0.85rem; margin-top: 4px; }
.target-card .stats { display: flex; gap: 18px; margin-top: 14px; font-size: 0.82rem; color: var(--silver); flex-wrap: wrap; }
.target-card .stats b { color: var(--pearl); font-weight: 500; }
.target-card .stats b.metric-ok { color: var(--up); }
.target-card .stats b.metric-warn { color: var(--amber); }
.target-card .stats b.metric-danger { color: var(--down); }

/* Esik/kademe renklendirmesi (bkz. includes/db.asp -> MetricTier): CPU/RAM/disk
   kartlarinin sol kenarligi ve deger metni durumu tek bakista gosterir. */
.panel.metric-ok { border-left: 4px solid var(--up); }
.panel.metric-warn { border-left: 4px solid var(--amber); }
.panel.metric-danger { border-left: 4px solid var(--down); }
.panel.metric-ok h3 { color: var(--up); }
.panel.metric-warn h3 { color: var(--amber); }
.panel.metric-danger h3 { color: var(--down); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; font-weight: 500; padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.status-up { color: var(--up); background: rgba(76,175,125,0.12); }
.badge.status-down { color: var(--down); background: rgba(224,90,90,0.12); }
.badge.status-unknown { color: var(--unknown); background: rgba(138,138,148,0.12); }
/* Ajan raporlamaya devam ediyor (baglanti OK) ama bir metrik (CPU/RAM/disk)
   kritik esigi asti - bkz. includes/db.asp -> EffectiveDisplayStatus. */
.badge.status-critical { color: var(--down); background: rgba(224,90,90,0.12); }
.target-card.status-critical { border-left-color: var(--down); }

.history-strip { display: flex; gap: 3px; margin-top: 12px; }
.history-strip span { flex: 1; height: 16px; border-radius: 2px; background: var(--unknown); }
.history-strip span.up { background: var(--up); }
.history-strip span.down { background: var(--down); }

/* ---- FORMS ---- */
form.stack { display: flex; flex-direction: column; gap: 16px; max-width: 420px; }
label { font-size: 0.85rem; color: var(--silver); display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid rgba(201,168,76,0.25);
  color: var(--pearl);
  padding: 11px 13px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }

.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  color: #1a1206;
  border: none;
  padding: 11px 22px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; border: 1px solid rgba(201,168,76,0.4); color: var(--gold-light); }
.btn.danger { background: var(--down); color: #fff5f5; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-box {
  background: rgba(224,90,90,0.12);
  border: 1px solid rgba(224,90,90,0.35);
  color: var(--error-text);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.auth-shell { max-width: 400px; margin: 60px auto; }
.auth-shell .panel { padding: 36px 32px; }
.auth-shell h1 { font-size: 1.6rem; margin-bottom: 22px; }
.auth-switch { margin-top: 18px; font-size: 0.88rem; color: var(--silver); }

/* ---- WIZARD ---- */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 28px; }
.wizard-steps .step {
  flex: 1; text-align: center; padding: 8px 4px; font-size: 0.78rem;
  color: var(--silver); border-bottom: 2px solid var(--ink);
}
.wizard-steps .step.active { color: var(--gold-light); border-color: var(--gold); }
.wizard-steps .step.done { color: var(--up); border-color: var(--up); }

.type-choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.type-choice {
  background: var(--ink); border: 1px solid rgba(201,168,76,0.2); border-radius: 8px;
  padding: 20px 14px; text-align: center; cursor: pointer;
}
.type-choice.selected { border-color: var(--gold); background: rgba(201,168,76,0.08); }
.type-choice .icon { font-size: 1.6rem; margin-bottom: 8px; }
.type-choice .label { font-weight: 500; }
.type-choice .desc { font-size: 0.78rem; color: var(--silver); margin-top: 4px; }

.wizard-actions { display: flex; justify-content: space-between; margin-top: 24px; }

/* ---- TOAST / POPUP ---- */
#toast-container {
  position: fixed; top: 76px; right: 20px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px; max-width: 320px;
}
.toast {
  padding: 14px 16px; border-radius: 8px; font-size: 0.88rem;
  background: var(--charcoal); border-left: 4px solid var(--unknown);
  box-shadow: 0 6px 18px var(--shadow);
  animation: toast-in 0.25s ease;
}
.toast.up { border-left-color: var(--up); }
.toast.down { border-left-color: var(--down); }
.toast strong { display: block; margin-bottom: 3px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.notice-bar {
  background: rgba(74,158,255,0.1); border: 1px solid rgba(74,158,255,0.3);
  color: var(--lens); padding: 10px 16px; border-radius: 6px; font-size: 0.85rem;
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--silver); }

/* ---- LOGO / THEME TOGGLE ---- */
.brand-mark {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 8px;
}
.brand-mark circle.ring { stroke: var(--gold); }
.brand-mark path.pulse { stroke: var(--gold-light); }
.brand-mark circle.dot { fill: var(--gold-light); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(201,168,76,0.3);
  background: transparent;
  color: var(--gold-light);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.theme-toggle:hover { background: rgba(201,168,76,0.1); }

/* ---- PROFILE ---- */
.profile-shell { max-width: 480px; }
.profile-shell .panel + .panel { margin-top: 20px; }
.success-box {
  background: rgba(76,175,125,0.12);
  border: 1px solid rgba(76,175,125,0.35);
  color: var(--up);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* ---- LANDING PAGE ---- */
body { overflow-x: hidden; }

.landing-hero {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(ellipse 60% 60% at 50% 45%, rgba(201,168,76,0.08) 0%, transparent 65%),
    var(--obsidian);
}

.landing-hero-pulse { width: 100%; max-width: 780px; }
.landing-hero-pulse svg { width: 100%; height: auto; display: block; }
.landing-hero-pulse .beat-base { stroke: rgba(201,168,76,0.16); }
.landing-hero-pulse .beat-live {
  stroke: var(--gold-light);
  stroke-dasharray: 26 640;
  animation: landing-pulse-travel 3.4s linear infinite;
  filter: drop-shadow(0 0 6px rgba(232,201,122,0.35));
}
@keyframes landing-pulse-travel {
  to { stroke-dashoffset: -666; }
}
@media (prefers-reduced-motion: reduce) {
  .landing-hero-pulse .beat-live { animation: none; stroke-dasharray: none; }
}
