:root {
  --bg: #050a14;
  --card: rgba(16, 24, 39, 0.92);
  --border: rgba(56, 78, 120, 0.45);
  --accent: #0078ff;
  --text: #e8eef8;
  --muted: #8b9cb8;
  --success: #22c55e;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(ellipse at 20% 0%, #0d1a33 0%, var(--bg) 50%, #030508 100%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 14, 26, 0.9);
}
.brand { font-weight: 700; color: #fff; letter-spacing: 0.04em; }
.nav { display: flex; gap: .75rem; align-items: center; }
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.muted { color: var(--muted); font-size: .9rem; }

.auth-card {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 0 32px rgba(0, 80, 200, 0.12);
}
.auth-card h1 { margin-top: 0; font-size: 1.35rem; }
.auth-card label { display: block; margin-bottom: 1rem; font-size: 0.88rem; color: var(--muted); }
.auth-card input {
  width: 100%;
  margin-top: .35rem;
  padding: .65rem .85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(5, 10, 20, 0.6);
  color: var(--text);
}
.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 120, 255, 0.2);
}
.remember-row {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  flex-direction: row !important;
  margin-bottom: 0.5rem !important;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
}
.remember-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: .6rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0055cc);
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 120, 255, 0.3);
}
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(239,68,68,0.45); }
.btn-sm { padding: .35rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.inline-form { display: inline; }
.inline-form-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.alert-error { background: rgba(80, 20, 30, 0.5); color: #ffb4b4; border: 1px solid rgba(239,68,68,0.35); }
.flash-wrap { margin-bottom: 1rem; }
.flash { padding: .65rem 1rem; border-radius: 10px; margin-bottom: .5rem; }
.flash-ok { background: rgba(34, 197, 94, 0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.flash-error { background: rgba(80, 20, 30, 0.5); color: #ffb4b4; border: 1px solid rgba(239,68,68,0.35); }

.product-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

body.dashboard-body {
  --bg: #000000;
  --card: #000000;
  background: #000000;
}

body.dashboard-body .product-table {
  background: transparent;
  border: none;
}
.product-table th, .product-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
}
.section { margin-bottom: 2rem; }
.section h2 { font-size: 1.1rem; margin-bottom: .75rem; }

.admin-form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.admin-form-card label,
.admin-inline-edit label {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
}
.admin-form-card input[type="text"],
.admin-form-card select,
.admin-form-card textarea,
.admin-inline-edit textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(5, 10, 20, 0.6);
  color: var(--text);
  font-family: inherit;
}
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 700px) {
  .admin-form-grid { grid-template-columns: 1fr; }
}
.admin-inline-edit {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.badge-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}
.badge-ok { color: #86efac; border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.12); }
.badge-muted { color: var(--muted); }
.badge-info { color: #93c5fd; border-color: rgba(59,130,246,0.35); background: rgba(59,130,246,0.12); }

/* —— Giriş sayfası (görsel üzerine yerleşim) —— */
body.auth-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: #050a14;
  background-image: url("../imgs/login.jpeg");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.auth-body .topbar {
  display: none !important;
}

.login-scene {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  max-width: none;
}

.login-form-scene {
  position: relative;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Login bloğu: masaüstünde logo altındaki panel boşluğuna oturur. */
.login-stack {
  position: absolute;
  left: 50%;
  top: clamp(26%, 30vh, 32%);
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  width: clamp(220px, 19vw, 340px);
  box-sizing: border-box;
}

.login-flash-wrap {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(420px, calc(100% - 2rem));
}

.login-error {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(420px, calc(100% - 2rem));
  margin: 0;
}

.login-field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.login-label {
  display: block;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
  text-shadow:
    0 0 10px rgba(34, 211, 238, 0.65),
    0 2px 6px rgba(0, 0, 0, 0.95);
}

.login-input {
  width: 100%;
  margin: 0;
  padding: 0.58rem 0.72rem;
  border-radius: 8px;
  border: 2px solid rgba(34, 211, 238, 0.75);
  background: rgba(4, 16, 38, 0.94);
  color: #f8fafc;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow:
    0 0 18px rgba(34, 211, 238, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.login-input::placeholder {
  color: rgba(186, 230, 255, 0.7);
}

.login-input:focus {
  outline: none;
  border-color: #67e8f9;
  box-shadow:
    0 0 0 2px rgba(34, 211, 238, 0.45),
    0 0 24px rgba(34, 211, 238, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.55);
}

.login-submit {
  width: 100%;
  margin: 0.15rem 0 0;
  padding: 0.62rem 1rem;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 8px;
  border: 2px solid rgba(125, 211, 252, 0.75);
  background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    0 0 26px rgba(34, 211, 238, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.5);
}

.login-submit:hover {
  filter: brightness(1.1);
}

.login-remember {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: #e0f2fe !important;
  text-shadow:
    0 0 8px rgba(34, 211, 238, 0.45),
    0 1px 4px rgba(0, 0, 0, 0.9) !important;
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  accent-color: #22d3ee;
}

@media (max-width: 900px) {
  body.auth-body {
    background-position: center bottom;
  }

  /* İlk düzeltilmiş mobil: panel boşluğunda ortalanmış stack (altta değil). */
  .login-stack {
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(86vw, 300px);
    gap: 0.6rem;
  }
}

/*
 * 1920x1080 referans (top: 30vh mükemmel).
 * Altı çözünürlüklerde formu hafifçe aşağı al (daha yüksek top = daha aşağı).
 */
@media (min-width: 901px) and (max-height: 1079px) {
  .login-stack {
    top: clamp(28%, 31vh, 33%);
  }
}

@media (min-width: 901px) and (max-height: 900px) {
  .login-stack {
    top: clamp(28%, 31.5vh, 33%);
  }
}

@media (min-width: 901px) and (max-height: 800px) {
  .login-stack {
    top: clamp(29%, 32vh, 34%);
  }
}

@media (max-width: 900px) and (max-height: 1079px) {
  .login-stack {
    top: 52%;
  }
}
