/*
 * BUSU Club UI sistemi
 * Temeller → bileşenler → ekran özelindeki tamamlayıcılar.
 * Eski sınıflar (card, kpi, pill) uyumluluk katmanı olarak korunur.
 */
:root {
  --ui-ink: #f7f3eb;
  --ui-muted: #aaa9a3;
  --ui-canvas: #090b0c;
  --ui-surface: #111416;
  --ui-surface-raised: #171b1d;
  --ui-surface-soft: #1d2224;
  --ui-border: rgba(255, 255, 255, .10);
  --ui-border-strong: rgba(226, 184, 105, .42);
  --ui-brand: #d9aa56;
  --ui-brand-bright: #f0ca83;
  --ui-danger: #e28a83;
  --ui-success: #8fd4a0;
  --ui-radius-sm: 10px;
  --ui-radius-md: 16px;
  --ui-radius-lg: 24px;
  --ui-shadow-1: 0 12px 30px rgba(0, 0, 0, .20);
  --ui-shadow-2: 0 24px 60px rgba(0, 0, 0, .34);
  --ui-ease: 180ms cubic-bezier(.2, .75, .25, 1);
}

/* Foundations */
html { background: var(--ui-canvas); }
body.app-shell {
  background:
    radial-gradient(650px 380px at 50% -170px, rgba(217, 170, 86, .16), transparent 72%),
    linear-gradient(180deg, #101315 0, var(--ui-canvas) 42%);
  color: var(--ui-ink);
  letter-spacing: .005em;
}
.app-header {
  isolation: isolate;
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 10px 32px rgba(0,0,0,.18);
}
.app-header h1 { text-shadow: 0 2px 20px rgba(217,170,86,.20); }
.app-content { animation: ui-enter .42s var(--ui-ease) both; }
@keyframes ui-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Components: role switcher */
.role-switcher {
  padding: 5px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: rgba(12, 15, 16, .78);
  box-shadow: var(--ui-shadow-1);
}
.role-switcher button {
  min-height: 50px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ui-muted);
  transition: color var(--ui-ease), background var(--ui-ease), border-color var(--ui-ease), transform var(--ui-ease);
}
.role-switcher button:first-child { color: var(--ui-ink); background: var(--ui-surface-soft); border-color: rgba(255,255,255,.06); }
.role-switcher button:hover { color: var(--ui-brand-bright); border-color: rgba(217,170,86,.25); transform: translateY(-1px); }

/* Components: surfaces and section headers */
.card {
  position: relative;
  overflow: hidden;
  border-color: var(--ui-border);
  box-shadow: var(--ui-shadow-1);
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,.035), transparent 28%);
}
.card > * { position: relative; z-index: 1; }
.section-title { padding-bottom: 12px; margin-bottom: 15px; border-bottom: 1px solid var(--ui-border); }
.section-title h2, .section-title h3 { letter-spacing: -.025em; }
.eyebrow {
  margin-bottom: 8px;
  color: var(--ui-brand-bright);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}

/* Components: auth */
.auth-card { padding: 26px; border-color: rgba(217,170,86,.25); }
.auth-card::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -110px;
  top: -125px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,170,86,.15), transparent 68%);
}
.auth-card--secondary { border-color: var(--ui-border); }
.auth-card h2 { margin: 0; font-size: clamp(22px, 5vw, 28px); }
.auth-card__intro { margin: 9px 0 22px; color: var(--ui-muted); font-size: 14px; line-height: 1.55; }

/* Components: controls */
button, .button-primary {
  transition: transform var(--ui-ease), box-shadow var(--ui-ease), filter var(--ui-ease), border-color var(--ui-ease);
}
button:hover:not(:disabled), .button-primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 24px rgba(0,0,0,.25); }
button:active:not(:disabled), .button-primary:active { transform: translateY(0); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--ui-brand-bright);
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; filter: saturate(.4); opacity: .55; }
.button-primary { display: inline-flex; justify-content: space-between; align-items: center; gap: 12px; }
.auth-card .button-primary { width: 100%; margin-top: 5px; }
input, select, textarea { transition: border-color var(--ui-ease), box-shadow var(--ui-ease), background var(--ui-ease); }
input:hover, select:hover, textarea:hover { border-color: rgba(255,255,255,.22); }

/* Components: compact data displays */
.kpi {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: var(--ui-radius-md);
  transition: transform var(--ui-ease), border-color var(--ui-ease), background var(--ui-ease);
}
.kpi:hover { transform: translateY(-2px); border-color: var(--ui-border-strong); background: var(--ui-surface-soft); }
.kpi .stat { margin-top: 5px; line-height: 1.1; }
.pill { letter-spacing: .03em; }
.list-item { border-radius: var(--ui-radius-sm); transition: border-color var(--ui-ease), background var(--ui-ease); }
.list-item:hover { border-color: rgba(217,170,86,.34); background: var(--ui-surface-soft); }

/* Components: tabs, tables and feedback */
.tabs { gap: 7px; padding: 4px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-md); background: rgba(11,13,14,.65); }
.tabs button { box-shadow: none; border-color: transparent; }
.tabs button:not(.active):hover { color: var(--ui-brand-bright); background: var(--ui-surface-soft); }
th { color: var(--ui-brand-bright); letter-spacing: .08em; }
tbody tr { transition: background var(--ui-ease); }
tbody tr:hover { background: rgba(217,170,86,.055); }
.msg { font-size: 13px; line-height: 1.45; }
.notice { border-radius: var(--ui-radius-sm); line-height: 1.5; }

/* Screen-specific composition */
#customerArea > .card, #employee .card, #admin .card { margin-bottom: 16px; }
#customerCampaignCard { padding-bottom: 18px; }
#customerPageAdvantages .adv-level { transition: transform var(--ui-ease), border-color var(--ui-ease); }
#customerPageAdvantages .adv-level:hover { transform: translateX(3px); border-color: var(--ui-brand); }
#customerPlans .card { transition: transform var(--ui-ease), border-color var(--ui-ease), box-shadow var(--ui-ease); }
#customerPlans .card:hover { transform: translateY(-3px); border-color: var(--ui-border-strong); box-shadow: var(--ui-shadow-2); }
.payment-card { border-color: var(--ui-border-strong); }
.modal-card { color: var(--ui-ink); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); }

/* Components: page headers and work surfaces */
#employee, #admin { max-width: 1040px; margin: 0 auto; }
#staffArea > .card:first-child,
#adminArea > .card:first-child,
#adminDashboard > .card,
#adminCampaigns > .card:first-child {
  border-color: rgba(217,170,86,.20);
}
#staffArea > .card:first-child::before,
#adminDashboard > .card:first-child::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--ui-brand-bright), rgba(217,170,86,0));
}
#staffArea .section-title, #adminArea .section-title { margin-top: -1px; }
#staffArea .grid.two > div,
#adminArea .grid.two > div,
#adminArea .grid.three > div,
#adminArea .grid.four > div {
  min-width: 0;
}

/* Components: operation cards */
#scannerBox {
  margin: 14px 0;
  padding: 14px;
  border: 1px dashed rgba(217,170,86,.35);
  border-radius: var(--ui-radius-md);
  background: rgba(217,170,86,.045);
}
#scannerBox video { border: 1px solid var(--ui-border); }
#findResult:empty, #entitlementBox:empty { display: none; }
#findResult, #entitlementBox { margin: 14px 0; }
#staffArea > .card + .card { margin-top: 16px; }

/* Components: admin navigation */
#adminArea > .tabs {
  position: sticky;
  top: 75px;
  z-index: 4;
  margin: 0 0 16px;
  padding: 6px;
  box-shadow: 0 12px 28px rgba(0,0,0,.24);
  backdrop-filter: blur(14px);
}
#adminArea > .tabs button { min-height: 36px; padding: 8px 11px; font-size: 11px; }
.adminTab > .card:first-child > h2,
.adminTab > .card:first-child > h3 { margin-top: 0; }
#adminDashboard > .grid.four { margin-bottom: 16px; }
#adminDashboard .kpi:nth-child(1) { border-top: 2px solid #e0b55c; }
#adminDashboard .kpi:nth-child(2) { border-top: 2px solid #c1b4f4; }
#adminDashboard .kpi:nth-child(3) { border-top: 2px solid #8fd4a0; }
#adminDashboard .kpi:nth-child(4) { border-top: 2px solid #82bee1; }

/* Components: data table shell */
.scroll {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: rgba(7,9,10,.24);
}
.scroll table { min-width: 620px; }
.scroll th { background: rgba(255,255,255,.025); }
.scroll th, .scroll td { padding: 13px 14px; }
.scroll tr:last-child td { border-bottom: 0; }
.row-actions { align-items: center; }
.row-actions button { box-shadow: none; }

/* Components: contextual member spaces */
#customerPageProfile .section-title,
#customerPageCard .section-title,
#customerPagePlans .section-title,
#customerPageAdvantages .section-title { margin-bottom: 16px; }
#customerQR h3 { margin: 0 0 10px; color: var(--ui-brand-bright); }
#customerHistory .scroll { margin-top: 10px; }
#customerEntitlements h3 { margin: 20px 0 10px; font-size: 16px; color: var(--ui-brand-bright); }
#customerEntitlements .kpi { min-height: 118px; }
#customerPlans .card h3 { margin: 0 0 7px; }
#customerPlans .card .mini { line-height: 1.75; }
#customerPlans .card button { width: 100%; }

/* Component variants retained for runtime-generated content */
.member-box, .v41-entitlements {
  border-radius: var(--ui-radius-md) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.v41-entitlements { border-color: var(--ui-border) !important; background: var(--ui-surface) !important; }
.v41-ent-row { border-color: var(--ui-border) !important; }
.v41-ent-btn { background: var(--ui-surface-soft); border: 1px solid var(--ui-border-strong); color: var(--ui-brand-bright); }

/* Empty states: give asynchronous areas a composed resting state */
#rewards:empty::before, #customerCampaigns:empty::before,
#recentTx:empty::before, #memberTable:empty::before {
  content: "İçerik yükleniyor…";
  display: block;
  padding: 18px;
  color: var(--ui-muted);
  text-align: center;
}

@media (min-width: 720px) {
  .wrap.app-content { max-width: 1040px; }
  .role-switcher { max-width: 620px; margin: 0 auto 22px; }
  #customerArea { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
  #customerArea > .card, #customerArea > #customerCampaignCard { margin-bottom: 0; }
  #customerArea > #customerCampaignCard { grid-column: span 2; }
}

@media (max-width: 600px) {
  .auth-card { padding: 21px 18px; }
  .role-switcher button { font-size: 11px; padding: 9px 4px; }
  .role-switcher button span { display: none; }
  .role-switcher button::first-letter { font-size: 17px; }
  .section-title { align-items: flex-start; }
  .section-title h2 { font-size: 20px; }
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; }
  #adminArea > .tabs { top: 0; margin-left: -4px; margin-right: -4px; border-radius: 0 0 var(--ui-radius-md) var(--ui-radius-md); }
  #customerEntitlements .grid { grid-template-columns: 1fr !important; }
  .scroll { border-radius: var(--ui-radius-sm); }
  .scroll th, .scroll td { padding: 11px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
