/* ExposiaVR lisans yonetimi -- lacivert + kirik beyaz, sol menu + tek bolum.
   "Tek bolum" gorunumu JS'siz: menu #musteriler/#urunler/... baglantilari, CSS :target ile
   yalnizca secilen <section class="view"> gosterilir (adres yoksa Musteriler).
   admin.js'in urettigi HTML (urun kartlari, tablolar, pill'ler) da buradan stillenir. */
:root {
  --navy: #14213d;
  --navy-2: #1c2c4f;
  --navy-3: #26385f;
  --side-text: #c6cede;
  --side-muted: #8592ad;

  --bg: #f6f4ef;
  --paper: #fffefb;
  --paper-2: #f1eee7;
  --line: #e3dfd5;
  --line-strong: #cfc9bb;
  --text: #17203a;
  --muted: #646d82;
  --dim: #9aa1b1;

  --accent: #c2662f;
  --accent-hover: #a8541f;
  --accent-soft: #f8e7da;

  --green: #2f7a55;
  --green-soft: #e1f0e7;
  --amber: #b7791f;
  --amber-soft: #fbefd9;
  --red: #b23b32;
  --red-soft: #f8e0dd;

  --sans: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  --shadow: 0 1px 2px rgba(20, 33, 61, .05), 0 4px 14px rgba(20, 33, 61, .05);
  color-scheme: light;
}

/* ---------- Temel ---------- */
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.02em; }
h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 13px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--navy-3); margin: 28px 0 10px; display: flex; align-items: center; gap: 10px; }
h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.muted { color: var(--muted); font-size: 13.5px; }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 12px; line-height: 1.65; }
.eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
a.link { color: var(--navy-3); font-weight: 600; text-decoration: none; cursor: pointer; }
a.link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Butonlar ---------- */
button {
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
  background: var(--navy); color: #fff;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover { background: var(--navy-3); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.secondary { background: var(--paper); color: var(--text); border-color: var(--line-strong); }
button.secondary:hover { border-color: var(--navy); background: var(--paper); }
button.danger { background: var(--paper); color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
button.danger:hover { background: var(--red-soft); border-color: var(--red); }
button[data-action="renewLicense"] { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
button[data-action="renewLicense"]:hover { background: var(--green); color: #fff; }
button[data-action="copy"] { background: var(--paper-2); color: var(--text); border-color: var(--line); font-weight: 500; font-size: 12.5px; padding: 7px 12px; }
button[data-action="copy"]:hover { border-color: var(--navy); }
button[data-action="createCustomer"], button[data-action="createProduct"], button[data-action="addLicense"],
button[data-action="createCustomerUser"], button[data-action="sendBroadcastMail"] { background: var(--accent); }
button[data-action="createCustomer"]:hover, button[data-action="createProduct"]:hover, button[data-action="addLicense"]:hover,
button[data-action="createCustomerUser"]:hover, button[data-action="sendBroadcastMail"]:hover { background: var(--accent-hover); }
td button { padding: 5px 11px; font-size: 12.5px; margin: 2px 4px 2px 0; }

/* ---------- Form alanlari ---------- */
input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text); background: var(--paper);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(38, 56, 95, .14); }
select { cursor: pointer; }
textarea { resize: vertical; line-height: 1.55; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 200px; min-width: 0; }
.w-sm { width: 180px; }
.w-md { width: 240px; }
.w-num { width: 90px; }
.w-icon { width: 1px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* ---------- Logo ---------- */
.brand { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--side-muted); letter-spacing: .02em; }
.logo {
  width: 36px; height: 36px; border-radius: 9px; flex: none; transform: rotate(-6deg);
  background:
    radial-gradient(circle at 33% 52%, var(--navy) 0 4px, transparent 4.5px),
    radial-gradient(circle at 67% 52%, var(--navy) 0 4px, transparent 4.5px),
    var(--accent);
}

/* ---------- Kabuk: sol menu + icerik ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px;
  background: var(--navy); color: #fff; padding: 24px 14px 18px; overflow-y: auto;
}
.sidebar .brand { padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 10.5px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); padding: 14px 12px 6px; }
.nav-label:first-child { padding-top: 0; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: var(--side-text); text-decoration: none; font-size: 14px; font-weight: 500; transition: background-color .15s, color .15s;
}
.nav-item svg { font-size: 18px; color: var(--side-muted); transition: color .15s; }
.nav-item:hover { background: var(--navy-2); color: #fff; }
/* aktif menu ogesi: adresteki #bolum ile eslesir; adres yoksa Musteriler */
body:has(#musteriler:target) .nav-item[href="#musteriler"],
body:has(#urunler:target) .nav-item[href="#urunler"],
body:has(#duyuru:target) .nav-item[href="#duyuru"],
body:has(#hesap:target) .nav-item[href="#hesap"],
body:has(#silinenler:target) .nav-item[href="#silinenler"],
body:has(#yoneticiler:target) .nav-item[href="#yoneticiler"],
body:not(:has(.view:target)) .nav-item[href="#musteriler"] { background: var(--navy-3); color: #fff; }
body:has(#musteriler:target) .nav-item[href="#musteriler"] svg,
body:has(#urunler:target) .nav-item[href="#urunler"] svg,
body:has(#duyuru:target) .nav-item[href="#duyuru"] svg,
body:has(#hesap:target) .nav-item[href="#hesap"] svg,
body:has(#silinenler:target) .nav-item[href="#silinenler"] svg,
body:has(#yoneticiler:target) .nav-item[href="#yoneticiler"] svg,
body:not(:has(.view:target)) .nav-item[href="#musteriler"] svg { color: var(--accent); }
body:has(#musteriler:target) .nav-item[href="#musteriler"]::before,
body:has(#urunler:target) .nav-item[href="#urunler"]::before,
body:has(#duyuru:target) .nav-item[href="#duyuru"]::before,
body:has(#hesap:target) .nav-item[href="#hesap"]::before,
body:has(#silinenler:target) .nav-item[href="#silinenler"]::before,
body:has(#yoneticiler:target) .nav-item[href="#yoneticiler"]::before,
body:not(:has(.view:target)) .nav-item[href="#musteriler"]::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}

.side-foot { display: flex; flex-direction: column; gap: 10px; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.status-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: #8fd3ad; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #5fc48d; box-shadow: 0 0 0 3px rgba(95, 196, 141, .18); }
#whoami { font-size: 12.5px; color: var(--side-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { margin-top: 4px; width: 100%; justify-content: flex-start; background: transparent; color: var(--side-text); border: 1px solid rgba(255, 255, 255, .14); font-weight: 500; }
.logout-btn svg { font-size: 16px; color: var(--side-muted); }
.logout-btn:hover { background: var(--navy-2); color: #fff; border-color: rgba(255, 255, 255, .28); }

.content { padding: 34px 44px 70px; min-width: 0; max-width: 1240px; }

/* tek bolum: yalnizca hedeflenen view gorunur */
.view { display: none; scroll-margin-top: 0; animation: view-in .2s ease-out; }
.view:target, body:not(:has(.view:target)) #musteriler { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.view-head .muted { margin: 4px 0 0; }

/* ---------- Paneller ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; font-weight: 650; font-size: 14.5px; }
.panel-head .muted { font-weight: 400; font-size: 12.5px; }
.panel.narrow { max-width: 460px; }
.panel.narrow .form-group input { width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; margin-bottom: 18px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; }
.toolbar.compact { margin: 10px 0 0; padding: 10px; }

/* musteri listesi + detay: detay acilinca genis ekranda yan yana */
.customers-layout { display: grid; gap: 18px; align-items: start; }
.list-panel { padding: 16px 0 6px; }
.list-panel .panel-head { padding: 0 18px; }
.list-panel .table-wrap { border: none; border-radius: 0; border-top: 1px solid var(--line); }
@media (min-width: 1200px) {
  .customers-layout:has(#customerDetail:not([hidden])) { grid-template-columns: 300px minmax(0, 1fr); }
  .customers-layout:has(#customerDetail:not([hidden])) .list-panel { position: sticky; top: 20px; }
  .customers-layout:has(#customerDetail:not([hidden])) table.customers th:nth-child(n+2),
  .customers-layout:has(#customerDetail:not([hidden])) table.customers td:nth-child(n+2) { display: none; }
  .customers-layout:has(#customerDetail:not([hidden])) .list-panel .panel-head .muted { display: none; }
}
table.customers td:first-child a.link { font-weight: 600; font-size: 14px; color: var(--text); }
table.customers td:first-child a.link:hover { color: var(--accent); }

.detail { padding: 24px 26px 26px; border-top: 3px solid var(--accent); }
.detail-head { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
#customerTitle { margin: 4px 0 2px; }

/* ---------- Urun kartlari (admin.js uretir) ---------- */
#productCards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 22px; }
.product-card {
  width: 100% !important; text-align: left; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 0 14px; overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s;
}
.product-card:hover { border-color: var(--line-strong); box-shadow: 0 8px 24px rgba(20, 33, 61, .1); }
.product-card > * { margin-left: 14px !important; margin-right: 14px !important; width: calc(100% - 28px) !important; }
.product-card img { margin: 0 !important; width: 100% !important; height: 130px; object-fit: cover; display: block; background: var(--navy-2); }
.product-card .name { font-size: 15.5px; font-weight: 650; margin-top: 12px !important; margin-bottom: 8px !important; }
.product-card input:not([type=file]) { font-size: 12.5px; padding: 7px 10px; font-family: var(--mono); }
.product-card input[type=file] { font-size: 11.5px; padding: 6px; color: var(--muted); background: var(--paper-2); border: 1px dashed var(--line-strong); border-radius: 8px; cursor: pointer; }
.product-card input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: none; border-radius: 6px; padding: 4px 10px; margin-right: 8px; background: var(--navy); color: #fff; cursor: pointer; }
.product-card .muted { font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted) !important; }
.product-card button[data-action="copy"] { justify-content: flex-start; }
.product-card progress { appearance: none; height: 6px; border: none; border-radius: 999px; overflow: hidden; background: var(--line); }
.product-card progress::-webkit-progress-bar { background: var(--line); }
.product-card progress::-webkit-progress-value { background: var(--accent); }
.product-card progress::-moz-progress-bar { background: var(--accent); }
.add-panel .panel-head { margin-bottom: 10px; }

/* ---------- Tablolar ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 9px 14px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--paper-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: #faf8f3; }
td.muted { font-variant-numeric: tabular-nums; }

/* aktivasyon tablolari (admin.js her lisans icin bir blok uretir) */
#activationsByLicense > div { margin-bottom: 14px !important; }
#activationsByLicense > div > .muted { font-weight: 600; color: var(--text); font-size: 13px; margin-bottom: 6px; }
#activationsByLicense table { border: 1px solid var(--line); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
#activationsByLicense td:first-child { font-family: var(--mono); font-size: 12.5px; }

/* ---------- Durum etiketleri ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 650; text-transform: capitalize; }
.pill.active { color: var(--green); background: var(--green-soft); }
.pill.active::before, .pill.suspended::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.suspended { color: var(--amber); background: var(--amber-soft); }
.pill.cancelled { color: var(--red); background: var(--red-soft); }
.pill.expired { color: var(--muted); background: var(--paper-2); border: 1px solid var(--line); }

/* ---------- Aktivasyon anahtari ---------- */
.key-box {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px;
  padding: 16px 18px; border-radius: 10px; background: var(--navy); color: #fff;
}
.key-label { font-size: 11px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); }
#customerKey { display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: .08em; color: #ffd8bd; }
.key-box button.secondary { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
.key-box button.secondary:hover { border-color: var(--accent); color: #ffd8bd; }

#customerUserSecret, #adminSecret {
  margin-top: 12px; justify-content: space-between; padding: 12px 16px; border-radius: 10px;
  background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
}
#customerUserSecret code, #adminSecret code { font-family: var(--mono); color: var(--text); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }

/* Rol: Destek kullanicisinda yalnizca Sahip'e ozel kontroller gizlenir
   (asil yetki kontrolu sunucuda: requireOwner). */
body[data-role="SUPPORT"] .owner-only { display: none !important; }

/* ---------- Toplu e-posta ---------- */
.mail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 18px; align-items: start; }
.mail-grid select { width: 100%; }
#mailCustomerList { max-height: 320px; overflow-y: auto; margin-top: 10px; padding: 6px; font-size: 13px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; }
#mailCustomerList > div { padding: 6px 8px; border-radius: 6px; margin-bottom: 1px !important; }
#mailCustomerList > div:hover { background: var(--paper); }
#mailCustomerList input[type=checkbox] { accent-color: var(--navy); width: 15px; height: 15px; padding: 0; }
.mail-form { display: flex; flex-direction: column; gap: 10px; }
#mailResultMsg { font-size: 13.5px; font-weight: 600; }
#pwMsg { display: block; margin-top: 12px; }

/* ---------- Giris ---------- */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 16px;
  background:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(700px 500px at 50% 30%, var(--navy-3), transparent 70%),
    var(--navy);
}
.login-card { width: 100%; max-width: 400px; background: var(--paper); border-radius: 14px; padding: 34px 32px 26px; box-shadow: 0 24px 60px rgba(4, 10, 25, .45); }
.login-card .brand { margin-bottom: 26px; }
.login-card .brand small { color: var(--muted); }
.login-card h1 { font-size: 24px; }
.login-card > .muted { margin: 4px 0 22px; }
.login-card input { width: 100%; padding: 11px 13px; }
.login-btn { width: 100%; padding: 12px 16px; margin-top: 4px; font-size: 14.5px; background: var(--accent); }
.login-btn:hover { background: var(--accent-hover); }
.login-error-wrap { text-align: center; margin-top: 10px; min-height: 1.4em; }
#loginError { color: var(--red); font-size: 13px; font-weight: 600; }
.login-foot { color: var(--side-muted); font-size: 12px; }

/* ---------- Dil secimi (i18n.js doldurur) ---------- */
.lang-select { padding: 6px 10px; font-size: 13px; font-weight: 600; border-radius: 999px; }
.login-screen { position: relative; }
.lang-corner { position: absolute; top: 18px; right: 20px; }
.lang-corner .lang-select { background-color: var(--navy-2); color: #fff; border-color: rgba(255, 255, 255, .22); }
.lang-corner .lang-select option { color: var(--text); background: var(--paper); }
.content-top { display: flex; justify-content: flex-end; margin: -18px 0 10px; }

/* ---------- Dar ekranlar ---------- */
@media (max-width: 960px) {
  .mail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; }
  .nav { flex: 1 1 100%; flex-direction: row; overflow-x: auto; order: 3; }
  .nav-label, .side-foot, .nav-item::before { display: none !important; }
  .nav-item { white-space: nowrap; }
  .content { padding: 24px 16px 56px; }
  .content-top { margin-top: -8px; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .toolbar, .row { flex-direction: column; align-items: stretch; }
  .toolbar > *, .row > *, .w-sm, .w-md, .w-num { width: 100% !important; }
}
