/* HBB — Auth + dashboard host stilleri */
:root {
  --hbb-bg: #f8fafc;
  --hbb-card: #ffffff;
  --hbb-text: #0f172a;
  --hbb-muted: #64748b;
  --hbb-border: #e5e7eb;
  --hbb-accent: #4338ca;
  --hbb-accent-hover: #3730a3;
  --hbb-success: #10b981;
  --hbb-danger: #dc2626;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--hbb-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--hbb-text);
  -webkit-font-smoothing: antialiased;
}

/* === Auth pages (login.html, access-denied.html) === */
.hbb-auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.hbb-auth-card {
  background: var(--hbb-card);
  border: 1px solid var(--hbb-border);
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 420px; width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}
.hbb-auth-card .hero-logo { text-align: center; margin-bottom: 14px; }
.hbb-auth-card .hero-logo img { height: 48px; }
.hbb-auth-card .product-label {
  text-align: center;
  font-size: 11px; letter-spacing: 2px; color: var(--hbb-muted);
  font-weight: 700; text-transform: uppercase; margin-bottom: 18px;
}
.hbb-auth-card h1 {
  font-size: 24px; font-weight: 800; letter-spacing: -0.5px;
  margin: 0 0 8px; text-align: center;
}
.hbb-auth-card .subtitle {
  font-size: 13px; color: var(--hbb-muted); text-align: center; margin: 0 0 24px; line-height: 1.5;
}
.hbb-auth-form { display: flex; flex-direction: column; gap: 10px; }
.hbb-label { font-size: 12px; font-weight: 600; color: var(--hbb-muted); }
.hbb-input {
  border: 1px solid var(--hbb-border); border-radius: 10px; padding: 12px 14px;
  font-size: 15px; font-family: inherit; color: var(--hbb-text);
  background: #fff; transition: all 0.15s;
}
.hbb-input:focus { outline: none; border-color: var(--hbb-accent); box-shadow: 0 0 0 3px rgba(67,56,202,0.12); }
.hbb-btn {
  border: none; border-radius: 10px; padding: 12px 16px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.hbb-btn-accent { background: var(--hbb-accent); color: #fff; }
.hbb-btn-accent:hover:not(:disabled) { background: var(--hbb-accent-hover); }
.hbb-btn-accent:disabled { opacity: 0.6; cursor: not-allowed; }
.hbb-btn-ghost { background: transparent; color: var(--hbb-muted); }
.hbb-btn-ghost:hover { color: var(--hbb-text); background: #f3f4f6; }
.hbb-text-muted { color: var(--hbb-muted); }
.hbb-success { color: var(--hbb-success); }
.hbb-danger { color: var(--hbb-danger); }
.hbb-auth-footer { font-size: 11px; color: var(--hbb-muted); text-align: center; margin-top: 22px; }

/* === my.html — admin shell === */
.hbb-shell {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hbb-border);
  padding: 10px 20px;
  display: flex; align-items: center; gap: 14px;
}
.hbb-shell .shell-logo img { height: 26px; vertical-align: middle; }
.hbb-shell .shell-label {
  font-size: 11px; letter-spacing: 1.5px; color: var(--hbb-muted);
  font-weight: 700; text-transform: uppercase;
}
.hbb-shell select {
  border: 1px solid var(--hbb-border); border-radius: 8px;
  padding: 6px 12px; font-size: 13px; font-family: inherit;
  background: #fff; min-width: 220px; cursor: pointer;
}
.hbb-shell .spacer { flex: 1; }
.hbb-shell .user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--hbb-muted);
}
.hbb-shell .logout-btn {
  background: transparent; border: 1px solid var(--hbb-border);
  border-radius: 8px; padding: 5px 10px;
  font-size: 12px; cursor: pointer; color: var(--hbb-muted);
}
.hbb-shell .logout-btn:hover { background: #fef2f2; border-color: #fca5a5; color: var(--hbb-danger); }

/* === Diamond picker button (shell'de native select yerine) === */
.diamond-picker-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--hbb-border); border-radius: 8px;
  padding: 7px 10px 7px 14px; cursor: pointer;
  font-size: 13px; font-family: inherit; color: var(--hbb-text);
  font-weight: 600; min-width: 220px; max-width: 340px;
  transition: all 0.15s;
}
.diamond-picker-btn:hover { background: #f9fafb; border-color: #c7d2fe; }
.diamond-picker-btn:focus-visible { outline: 2px solid var(--hbb-accent); outline-offset: 2px; }
.dpb-label {
  flex: 1; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dpb-arrow { opacity: 0.5; flex-shrink: 0; }

/* === Bottom sheet === */
.diamond-sheet {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
}
.diamond-sheet[aria-hidden="false"] { pointer-events: auto; }
.ds-overlay {
  position: absolute; inset: 0; background: rgba(15,23,42,0.5);
  opacity: 0; transition: opacity 0.25s ease;
}
.diamond-sheet[aria-hidden="false"] .ds-overlay { opacity: 1; }
.ds-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
  max-height: 80vh; max-height: 80dvh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.diamond-sheet[aria-hidden="false"] .ds-panel { transform: translateY(0); }
.ds-handle {
  width: 36px; height: 4px; background: #d1d5db; border-radius: 100px;
  margin: 8px auto 0;
}
.ds-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px 8px;
}
.ds-title { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; color: var(--hbb-text); }
.ds-close {
  width: 32px; height: 32px; border-radius: 8px; border: none; background: #f3f4f6;
  font-size: 20px; color: var(--hbb-muted); cursor: pointer; line-height: 1;
}
.ds-close:hover { background: #e5e7eb; color: var(--hbb-text); }
.ds-search-wrap {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 18px 12px;
  padding: 10px 14px;
  background: #f3f4f6; border: 1px solid transparent; border-radius: 12px;
  transition: all 0.15s;
}
.ds-search-wrap:focus-within { background: #fff; border-color: var(--hbb-accent); box-shadow: 0 0 0 3px rgba(67,56,202,0.1); }
.ds-search-wrap svg { opacity: 0.5; flex-shrink: 0; }
#ds-search {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 16px; font-family: inherit; color: var(--hbb-text);
  padding: 0; min-width: 0;
}
.ds-clear {
  border: none; background: transparent; color: var(--hbb-muted);
  font-size: 18px; cursor: pointer; padding: 0 4px;
}
.ds-list {
  flex: 1; overflow-y: auto;
  padding: 0 12px 12px;
  -webkit-overflow-scrolling: touch;
}
.ds-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 12px 14px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--hbb-text);
  text-align: left; cursor: pointer;
  transition: all 0.1s;
}
.ds-row:hover { background: #f9fafb; }
.ds-row.is-selected { background: #eef2ff; border-color: #c7d2fe; font-weight: 700; }
.ds-row-rank {
  font-size: 11px; color: var(--hbb-muted); font-weight: 600;
  padding: 2px 8px; background: #f3f4f6; border-radius: 100px;
  margin-left: 8px; flex-shrink: 0;
}
.ds-row.is-selected .ds-row-rank { background: rgba(67,56,202,0.15); color: #3730a3; }
.ds-empty { padding: 32px 18px; text-align: center; color: var(--hbb-muted); font-size: 13px; }

@media (max-width: 720px) {
  .diamond-picker-btn { flex: 1; min-width: 0; max-width: none; }
  .ds-panel { max-height: 88vh; max-height: 88dvh; }
}

#hbb-frame {
  width: 100%;
  height: calc(100dvh - 56px);
  border: none;
  display: block;
}
.hbb-loading {
  position: fixed; inset: 56px 0 0 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--hbb-muted); font-size: 14px;
  background: var(--hbb-bg);
  padding: 20px;
  text-align: center;
}

/* === Access denied === */
.hbb-denied {
  text-align: center;
}
.hbb-denied .icon { font-size: 48px; margin-bottom: 16px; }
.hbb-denied h2 { margin: 0 0 12px; font-size: 22px; }
.hbb-denied p { color: var(--hbb-muted); line-height: 1.6; margin: 0 0 20px; }

/* === iOS Add-to-Home-Screen banner === */
.a2hs-banner {
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  background: #1f2937; color: #fff;
  border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 9999;
  font-size: 13px; line-height: 1.5;
  animation: a2hsSlideUp 0.35s ease-out;
}
@keyframes a2hsSlideUp { from { transform: translateY(120%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.a2hs-body { flex: 1; }
.a2hs-body b { color: #fbbf24; }
.a2hs-steps { font-size: 12px; color: #d1d5db; margin-top: 4px; }
.a2hs-steps span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 4px; background: #4b5563;
  margin: 0 2px; font-weight: 700;
}
.a2hs-close {
  background: transparent; border: none; color: #d1d5db;
  font-size: 22px; padding: 0 4px; cursor: pointer; line-height: 1;
  align-self: flex-start;
}
.a2hs-close:hover { color: #fff; }

/* === MOBİL UYUM (my.html shell) === */
@media (max-width: 720px) {
  .hbb-shell {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
    /* iOS safe area (notch) */
    padding-top: calc(8px + env(safe-area-inset-top, 0));
    padding-left: calc(12px + env(safe-area-inset-left, 0));
    padding-right: calc(12px + env(safe-area-inset-right, 0));
  }
  .hbb-shell .shell-logo img { height: 22px; }
  .hbb-shell .shell-label { font-size: 10px; letter-spacing: 1px; }
  .hbb-shell select {
    flex: 1; min-width: 0; max-width: 100%;
    font-size: 14px;
    padding: 8px 10px;
    /* Tap-friendly */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'><path d='M4 6l4 4 4-4' stroke='%236b7280' fill='none' stroke-width='2'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
  }
  .hbb-shell .spacer { display: none; }
  .hbb-shell .user-chip {
    font-size: 11px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .hbb-shell .logout-btn {
    padding: 6px 10px;
    font-size: 11px;
    /* Min 44x44 tap target — buton ufak ama dokunulabilir */
    min-height: 32px;
  }
  /* Mobilde iframe daha fazla yer kapsın */
  #hbb-frame { height: calc(100dvh - 110px); }  /* shell genişledi mobilde */
  .hbb-loading { inset: 110px 0 0 0; }

  /* === Auth pages mobile === */
  .hbb-auth-wrap { padding: 16px; padding-top: calc(16px + env(safe-area-inset-top, 0)); }
  .hbb-auth-card { padding: 28px 22px; }
  .hbb-auth-card h1 { font-size: 22px; }
  .hbb-auth-card .subtitle { font-size: 12px; }
  .hbb-input { font-size: 16px; /* iOS auto-zoom prevention */ padding: 13px 14px; }
  .hbb-btn { padding: 13px 16px; font-size: 14px; min-height: 44px; /* tap target */ }
}

/* iOS standalone (Add to Home Screen modu) — sayfa tam ekran */
@media (display-mode: standalone) {
  .a2hs-banner { display: none; }  /* already installed */
}

/* iPhone notch safe areas in standalone */
@supports (padding: max(0px)) {
  body { padding-bottom: env(safe-area-inset-bottom, 0); }
}
