/* SmartVsearch Admin Panel — Aston yeşili + koyu tema */
:root {
  --bg:        #0d1117;
  --bg-soft:   #161b22;
  --bg-card:   #1c232d;
  --border:    #2d3540;
  --text:      #e6edf3;
  --text-mute: #8b949e;
  --accent:    #0a4a35;   /* Aston Martin Racing Green */
  --accent-2:  #1a7a5c;
  --accent-glow: rgba(26, 122, 92, 0.4);
  --danger:    #f85149;
  --warn:      #d29922;
  --success:   #3fb950;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2 { font-weight: 600; letter-spacing: -0.02em; margin: 0 0 12px; }
h1 { font-size: 22px; }
h2 { font-size: 16px; margin-bottom: 16px; }
p { margin: 0 0 12px; }

code { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; }

.muted { color: var(--text-mute); }
.small { font-size: 12px; }
.center { text-align: center; }
.error { color: var(--danger); margin-top: 8px; }
.grow { flex: 1; }

/* ── Topbar ── */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 12px var(--accent-glow);
}
.brand-text em { font-style: normal; color: var(--text-mute); font-weight: 400; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
}
.pill-muted { color: var(--text-mute); }
.pill-ok { background: rgba(63, 185, 80, 0.15); color: var(--success); border-color: rgba(63, 185, 80, 0.3); }
.pill-bad { background: rgba(248, 81, 73, 0.15); color: var(--danger); border-color: rgba(248, 81, 73, 0.3); }

/* ── Layout ── */
#main { padding: 24px; max-width: 1200px; margin: 0 auto; }
.view {}
.view-center {
  min-height: calc(100vh - 80px);
  display: flex; align-items: center; justify-content: center;
}
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 12px;
}
.toolbar h1 { margin: 0; }
.toolbar-actions { display: flex; gap: 8px; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-narrow { max-width: 460px; width: 100%; }

/* ── Forms ── */
label { display: block; margin-bottom: 14px; }
label > span { display: block; font-size: 12px; color: var(--text-mute); margin-bottom: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
label small { display: block; font-size: 11px; color: var(--text-mute); margin-top: 4px; }
input[type="text"], input[type="url"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 60px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px; border-radius: 6px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent-2); }
.btn-primary:hover { background: var(--accent-2); box-shadow: 0 0 16px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger { background: rgba(248, 81, 73, 0.1); color: var(--danger); border-color: rgba(248, 81, 73, 0.3); }
.btn-block { width: 100%; }

/* ── Factory grid ── */
.grid-factories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.factory-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.factory-card:hover {
  border-color: var(--accent-2);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
}
.factory-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.factory-card-name { font-weight: 600; font-size: 15px; margin: 0; }
.factory-card-id { font-size: 11px; color: var(--text-mute); margin-top: 2px; font-family: ui-monospace, monospace; }
.factory-card-tier {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(26, 122, 92, 0.15); color: var(--accent-2);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.factory-card-credits {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 10px;
}
.credit-mini {
  background: var(--bg-soft); padding: 6px; border-radius: 5px;
  text-align: center;
}
.credit-mini-label { font-size: 9px; color: var(--text-mute); text-transform: uppercase; }
.credit-mini-value { font-size: 14px; font-weight: 600; margin-top: 2px; }
.credit-mini-value.low { color: var(--warn); }
.credit-mini-value.zero { color: var(--danger); }

/* ── Tables / KV ── */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--text-mute); font-size: 12px; }
.kv dd { margin: 0; font-family: ui-monospace, monospace; font-size: 13px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-mute); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.table tr:hover td { background: var(--bg-soft); }

/* ── Activity ── */
.activity { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow-y: auto; }
.activity li {
  padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
  display: flex; justify-content: space-between; gap: 12px;
}
.activity li:last-child { border-bottom: none; }
.activity-event { font-weight: 500; }
.activity-time { color: var(--text-mute); font-size: 11px; font-family: ui-monospace, monospace; }

/* ── Switch (toggle) ── */
.switch { display: inline-flex; align-items: center; cursor: pointer; gap: 10px; }
.switch input { display: none; }
.switch .slider {
  position: relative; width: 40px; height: 22px;
  background: var(--border); border-radius: 22px; transition: 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 18px; height: 18px; background: white; border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent-2); box-shadow: 0 0 12px var(--accent-glow); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch-label { font-size: 14px; }

.row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
/* HTML hidden attribute'unu zorla — class display:flex'i override etmesin */
.modal[hidden], [hidden] { display: none !important; }
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; max-width: 480px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.key-display {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 12px; border-radius: 6px; margin: 12px 0;
  display: flex; align-items: center; gap: 10px;
}
.key-display code {
  flex: 1; word-break: break-all; background: transparent; padding: 0;
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-card); border: 1px solid var(--accent-2);
  padding: 14px 20px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 20px var(--accent-glow);
  z-index: 200;
  animation: slideIn 0.2s ease-out;
}
.toast.error { border-color: var(--danger); box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 20px rgba(248,81,73,0.3); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
