/* KuponMatik — kimlik doğrulama arayüzü */

body:not(.auth-ready) .app { display: none !important; }

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(163, 255, 46, 0.10), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(0, 245, 196, 0.08), transparent 60%),
    var(--bg);
}
.auth-overlay[hidden] { display: none !important; }

.auth-card {
  width: min(430px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px 18px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.auth-brand strong {
  font-family: var(--display);
  letter-spacing: -0.02em;
  font-size: 17px;
}
.auth-brand strong span { color: var(--accent); }
.auth-brand small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-title {
  font-family: var(--display);
  font-size: 19px;
  margin: 0 0 6px;
}
.auth-sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.5;
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.pad { padding: 18px 20px 22px; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--txt);
}
.auth-form label small { color: var(--muted); font-weight: 500; }
.auth-form input,
.uc-grid input,
.uc-grid select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--txt);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}
.auth-form input:focus,
.uc-grid input:focus,
.uc-grid select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(163, 255, 46, 0.14);
}

.auth-error {
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.4);
  color: #ffb3c1;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.45;
}

.auth-foot {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.8px;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ */
/* yan menü grupları                                                   */
/* ------------------------------------------------------------------ */

.nav { gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 0 13px 6px;
}
#navAdminGroup .nav-label { color: rgba(163, 255, 46, 0.72); }
#navAdminGroup .nav-btn { border-color: rgba(163, 255, 46, 0.14); }
#navAdminGroup .nav-btn:hover { border-color: rgba(163, 255, 46, 0.32); }

/* ------------------------------------------------------------------ */
/* hesap menüsü (avatar + açılır liste)                                */
/* ------------------------------------------------------------------ */

.account-chip { position: relative; }

.ac-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px 5px 6px;
  color: var(--txt);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.ac-trigger:hover,
.account-chip.open .ac-trigger {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}
.ac-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #00f5c4);
  color: #06110a;
  font-weight: 800;
  font-size: 12px;
  flex: 0 0 26px;
}
.ac-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.ac-name { font-weight: 700; font-size: 12px; }
.ac-role {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.ac-role.admin { color: var(--accent); }
.ac-chev {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
}
.account-chip.open .ac-chev { transform: rotate(180deg); }

.ac-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 400;
  width: 218px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--panel-solid);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ac-menu[hidden] { display: none !important; }
.ac-menu-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ac-menu-head strong { font-size: 12.5px; }
.ac-menu-head span {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ac-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--txt);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}
.ac-menu button:hover { background: rgba(255, 255, 255, 0.06); }
.ac-menu button.danger { color: #ff8095; }
.ac-menu button.danger:hover { background: rgba(255, 77, 109, 0.12); }
.ac-menu button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
  flex: 0 0 15px;
}
.ac-menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* kullanıcı yönetimi */
.auth-modal .modal-card.wide { width: min(1080px, 96vw); max-height: 88vh; }
.users-body { padding: 16px 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.uc-grid { display: grid; grid-template-columns: 1fr 1fr 130px auto; gap: 9px; align-items: center; }
.uc-grid .switch.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--muted);
}
.users-table { width: 100%; border-collapse: collapse; font-size: 12.3px; }
.users-table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 7px 8px;
  border-bottom: 1px solid var(--line-strong);
}
.users-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users-table .u-actions { text-align: right; white-space: nowrap; }
.users-table .u-actions .linkbtn { font-size: 11px; margin-left: 7px; }
.linkbtn.danger { color: var(--danger); }

.audit-log {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 190px;
  overflow-y: auto;
  font-size: 11px;
}
.audit-row {
  display: grid;
  grid-template-columns: 132px 96px 1fr 1fr 1.4fr;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
}
.audit-row:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.audit-row.bad { color: #ffb3c1; }
.audit-row .ar-ev { font-weight: 700; }
.audit-row .ar-ip,
.audit-row .ar-ts,
.audit-row .ar-user { color: var(--muted); }

.auth-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 12.5px;
  z-index: 9500;
  box-shadow: var(--shadow);
}
.auth-toast.ok { border-color: rgba(56, 239, 125, 0.5); }
.auth-toast.err { border-color: rgba(255, 77, 109, 0.55); }

@media (max-width: 760px) {
  .uc-grid { grid-template-columns: 1fr 1fr; }
  .users-table .u-actions .linkbtn { display: inline-block; margin: 2px 4px 2px 0; }
  .account-chip .ac-role { display: none; }
}

/* yönetim sekmeleri */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
  margin-right: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.admin-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* IP erişimi */
.ip-head { display: flex; flex-direction: column; gap: 8px; }
.ip-mode-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ip-mode-row select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--txt);
  font-size: 12.5px;
  font-family: var(--font);
  min-width: 260px;
}
.ip-note {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  background: rgba(255, 183, 3, 0.07);
  border: 1px solid rgba(255, 183, 3, 0.25);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}
.ip-grid { display: grid; grid-template-columns: 1.5fr 140px 1fr auto; gap: 9px; align-items: center; }
.ip-grid input, .ip-grid select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--txt);
  font-size: 12.5px;
  font-family: var(--font);
  outline: none;
}
.ip-grid input:focus, .ip-grid select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(163, 255, 46, 0.14);
}
.ip-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; }
.ip-list { max-height: 300px; overflow-y: auto; }
.ip-table { font-size: 11.6px; }
.ip-table td { padding: 7px 6px; }
.ip-table .pill { font-size: 9.5px; }

@media (max-width: 900px) {
  .ip-cols { grid-template-columns: 1fr; }
  .ip-grid { grid-template-columns: 1fr 120px; }
}

/* ------------------------------------------------------------------ */
/* yönetim sekmesi — ayrı sayfa                                        */
/* ------------------------------------------------------------------ */

#tab-yonetim > .admin-tabs {
  margin: 0 0 18px;
  width: fit-content;
  padding: 4px;
}
#tab-yonetim .admin-tab { font-size: 12px; padding: 7px 18px; }

#tab-yonetim .admin-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeUp 0.3s ease;
}
#tab-yonetim .admin-pane[hidden] { display: none !important; }

#tab-yonetim .card-head { margin-bottom: 16px; }
#tab-yonetim .card-head .hint { margin: 5px 0 0; max-width: 62ch; }
#tab-yonetim .ip-note { margin-top: 14px; }
#tab-yonetim .ip-list { max-height: 440px; }
#tab-yonetim .users-list { overflow-x: auto; }
#tab-yonetim .audit-log { max-height: 320px; }

@media (max-width: 760px) {
  .ac-meta { display: none; }
  #tab-yonetim .uc-grid { grid-template-columns: 1fr; }
  #tab-yonetim .ip-grid { grid-template-columns: 1fr; }
}

/* yatay üst menüye düşen dar ekranlar: grupları düzleştir */
@media (max-width: 980px) {
  .nav { gap: 4px; }
  .nav-group {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
  }
  .nav-label { display: none; }
  #navAdminGroup .nav-btn { border-color: transparent; }
}

/* kısa ekranlarda dikey menü taşmasın */
@media (min-width: 981px) and (max-height: 760px) {
  .sidebar { overflow-y: auto; }
  .nav-label { font-size: 9px; padding-bottom: 3px; }
}
