/* ══════════════════════════════════════
   DEĞİŞKENLER
══════════════════════════════════════ */
:root {
  --gold: #c49a6c;
  --gold-light: #d4b088;
  --gold-dark: #a67c52;
  --brown: #3d3428;
  --brown-light: #5a4a38;
  --cream: #fffcf5;
  --cream-dark: #f5f1e8;
  --border: #e8dcc8;
  --text: #3d3428;
  --muted: #7a6f5d;
  --red: #c0392b;
  --red-bg: rgba(192,57,43,.07);
  --red-border: rgba(192,57,43,.18);
  --green: #2e7d32;
  --green-bg: rgba(46,125,50,.08);
  --green-border: rgba(46,125,50,.2);
}
* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'DM Sans', Arial, sans-serif;
  background: var(--cream-dark);
  color: var(--text);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}
a { color: inherit; }

/* ══════════════════════════════════════
   GİRİŞ SAYFASI
══════════════════════════════════════ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background: linear-gradient(135deg, var(--brown) 0%, var(--brown-light) 55%, #7a6548 100%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: rgba(255,252,245,.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(232,220,200,.65);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 80px -20px rgba(61,52,40,.45), 0 0 0 1px rgba(255,255,255,.18) inset;
  animation: cardIn .55s cubic-bezier(.23,1,.32,1) both;
}
@keyframes cardIn { from { opacity:0; transform: translateY(24px) scale(.97);} to {opacity:1; transform:none;} }
.login-header {
  background: linear-gradient(135deg, var(--brown) 0%, var(--brown-light) 55%, #7a6548 100%);
  padding: 28px 28px 22px;
  display: flex; align-items: center; gap: 14px;
  position: relative; overflow: hidden;
}
.login-header::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 18% 28%, rgba(196,154,108,.28) 0%, transparent 50%),
              radial-gradient(circle at 82% 72%, rgba(196,154,108,.16) 0%, transparent 50%);
}
.login-logo {
  width: 46px; height: 46px; flex-shrink: 0; position: relative; z-index: 1;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.login-title { position: relative; z-index: 1; }
.login-title h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 19px; font-weight: 900; color: #fff; letter-spacing: -.02em;
}
.login-title p { font-size: 11.5px; color: rgba(255,255,255,.6); margin-top: 3px; }
.login-body-inner { padding: 26px 28px 24px; }

.field { margin-bottom: 15px; }
.field label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  background: var(--cream); border: 1.5px solid var(--border); border-radius: 12px;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500; color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold); background: #fff; box-shadow: 0 0 0 4px rgba(196,154,108,.13);
}
.field-fixed {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; background: var(--green-bg); border: 1.5px solid var(--green-border);
  border-radius: 12px; font-size: 15px; font-weight: 700; color: var(--green);
}
.field-fixed svg { flex-shrink: 0; }

.btn-block {
  width: 100%; padding: 13px 16px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  border: none; border-radius: 13px;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 800; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; box-shadow: 0 8px 26px -4px rgba(196,154,108,.45);
  transition: transform .25s, box-shadow .25s, filter .2s;
}
.btn-block:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -4px rgba(196,154,108,.52); filter: brightness(1.04); }

.login-alert {
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--red-bg); border: 1px solid var(--red-border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 16px; font-size: 13px; font-weight: 600; color: var(--red);
  line-height: 1.4;
}
.login-alert svg { flex-shrink: 0; margin-top: 1px; }

/* ══════════════════════════════════════
   UYGULAMA GENEL
══════════════════════════════════════ */
.topbar {
  background: linear-gradient(135deg, var(--brown) 0%, var(--brown-light) 100%);
  color: #fff; padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  position: sticky; top: 0; z-index: 50;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand .logo { width: 34px; height: 34px; background: rgba(255,255,255,.14); border-radius: 10px; display:flex; align-items:center; justify-content:center; }
.topbar-brand span { font-family: 'Playfair Display', Georgia, serif; font-weight: 800; font-size: 17px; }
.topbar-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar-nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 10px; text-decoration: none;
  font-size: 13.5px; font-weight: 700; color: rgba(255,255,255,.78);
  transition: background .2s, color .2s;
}
.topbar-nav a:hover, .topbar-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar-user .role-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 10.5px; font-weight: 800;
  background: rgba(196,154,108,.25); color: var(--gold-light); text-transform: uppercase; letter-spacing: .04em;
}
.topbar-user a.logout-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 10px; text-decoration: none;
  color: rgba(255,255,255,.75); font-weight: 700; font-size: 13px;
  transition: background .2s;
}
.topbar-user a.logout-link:hover { background: rgba(255,255,255,.12); color: #fff; }

.hamburger-btn { display: none; background: none; border: none; color: #fff; cursor: pointer; padding: 6px; }
.topbar-nav-mobile-user { display: none; }

.container { max-width: 1150px; margin: 28px auto; padding: 0 20px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { font-family: 'Playfair Display', Georgia, serif; font-size: 24px; font-weight: 800; color: var(--brown); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.search-form { display: flex; gap: 8px; }
.search-form input {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 12px; width: 280px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; background: #fff;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; background: #fff; color: var(--text);
  border: 1.5px solid var(--border); border-radius: 11px; text-decoration: none;
  font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 13.5px; cursor: pointer;
  transition: all .2s;
}
.btn:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(196,154,108,.18); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); color: #fff; border: none;
  box-shadow: 0 6px 18px -4px rgba(196,154,108,.45);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 8px 22px -4px rgba(196,154,108,.5); }
.btn-danger { color: var(--red); border-color: var(--red-border); }
.btn-danger:hover { border-color: var(--red); box-shadow: 0 4px 14px rgba(192,57,43,.15); }
.btn-secondary { background: var(--cream-dark); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-small { padding: 6px 11px; font-size: 12px; border-radius: 9px; }

.card-panel {
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 4px 20px rgba(61,52,40,.05);
}

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13.5px; }
.tbl th { background: var(--cream-dark); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 800; }
.tbl tr:hover td { background: rgba(196,154,108,.04); }
.tbl-avatar { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: var(--cream-dark); border: 1px solid var(--border); }
.mobile-only-line { display: none; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.badge-ok { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-wait { background: var(--cream-dark); color: var(--muted); border: 1px solid var(--border); }
.badge-role { background: rgba(196,154,108,.15); color: var(--gold-dark); border: 1px solid rgba(196,154,108,.3); }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.alert-ok { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }

.form-box { background: #fff; padding: 28px; border-radius: 18px; max-width: 560px; border: 1px solid var(--border); box-shadow: 0 4px 20px rgba(61,52,40,.05); }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }
.checkbox-label { font-weight: 600 !important; text-transform: none !important; display: flex !important; align-items: center; gap: 8px; font-size: 14px !important; }
.checkbox-label input { width: auto; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; display: block; }

/* Kamera / OCR butonları */
.scan-actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.scan-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(196,154,108,.08), rgba(196,154,108,.02));
  border: 1.5px solid var(--gold); color: var(--gold-dark);
  font-weight: 800; font-size: 13.5px; cursor: pointer; transition: all .2s;
}
.scan-btn:hover { background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); color: #fff; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(196,154,108,.35); }
.scan-btn .icn { width: 34px; height: 34px; border-radius: 10px; background: rgba(196,154,108,.15); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.scan-btn:hover .icn { background: rgba(255,255,255,.2); }

/* Kamera modal */
.cam-modal { position: fixed; inset: 0; background: rgba(20,16,10,.85); display: none; align-items: center; justify-content: center; z-index: 999; padding: 20px; }
.cam-modal.show { display: flex; }
.cam-box { background: #fff; border-radius: 20px; overflow: hidden; width: min(90vw, 340px); max-height: 90vh; box-shadow: 0 30px 70px rgba(0,0,0,.4); display: flex; flex-direction: column; }
.cam-box-head { padding: 16px 20px; background: var(--brown); color: #fff; display:flex; align-items:center; justify-content: space-between; flex-shrink: 0; }
.cam-box-head h3 { font-size: 15px; font-weight: 800; }
.cam-box-head button { background: none; border: none; color: #fff; cursor: pointer; opacity: .7; }
.cam-video-wrap { position: relative; background: #000; aspect-ratio: 4/3; flex-shrink: 1; min-height: 0; overflow: hidden; }
.cam-video-wrap video, .cam-video-wrap canvas { width: 100%; height: 100%; object-fit: cover; }
.cam-video-wrap video { cursor: pointer; }
.cam-video-wrap canvas { display: none; }
.cam-box-actions { padding: 14px 20px; display: flex; gap: 10px; flex-shrink: 0; }
.cam-box-actions .btn { flex: 1; justify-content: center; }
.cam-status { padding: 8px 20px 14px; font-size: 12.5px; color: var(--muted); text-align: center; flex-shrink: 0; }
.cam-status.loading { color: var(--gold-dark); font-weight: 700; }

.photo-preview { width: 90px; height: 90px; border-radius: 14px; object-fit: cover; border: 2px solid var(--border); background: var(--cream-dark); }
.photo-preview-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; height: 56px; }
  .topbar-brand span { font-size: 15px; }
  .hamburger-btn { display: flex; align-items: center; }
  .topbar-user { display: none; }
  .topbar-nav {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    background: var(--brown); flex-direction: column; align-items: stretch;
    padding: 8px 14px 14px; gap: 4px; box-shadow: 0 12px 24px rgba(0,0,0,.25);
    z-index: 60;
  }
  .topbar-nav.open { display: flex; }
  .topbar-nav a { width: 100%; }
  .topbar-nav-mobile-user {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12);
    font-size: 13px; color: rgba(255,255,255,.8);
  }
  .search-form input { width: 100%; }
  .search-form { width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .container { margin: 18px auto; }

  /* Popup'lar mobilde ekrana tam sığar */
  .iframe-modal { padding: 0; }
  .iframe-modal-box { width: 100vw; height: 100vh; height: 100dvh; max-width: 100vw; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .iframe-modal-body iframe { min-height: 0; height: 100%; }
  .cam-modal { padding: 0; }
  .cam-box { width: 100vw; height: 100vh; height: 100dvh; max-width: 100vw; max-height: 100dvh; border-radius: 0; display: flex; flex-direction: column; }
  .cam-video-wrap { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; }

  /* Konaklayan listesi - mobilde sade görünüm */
  .tbl .mobile-hide { display: none; }
  .tbl th, .tbl td { padding: 10px 8px; font-size: 12.5px; }
  .tbl-avatar { width: 30px; height: 30px; }
  .mobile-only-line { display: block; margin-top: 2px; }

  /* Kamera/kimlik tarama butonları mobilde yan yana kalır */
  .scan-actions { flex-wrap: nowrap; gap: 6px; }
  .scan-btn { flex: 1 1 0; min-width: 0; padding: 8px 6px; font-size: 11px; gap: 6px; white-space: normal; text-align: left; line-height: 1.25; }
  .scan-btn .icn { width: 26px; height: 26px; }
  .scan-btn .icn svg { width: 14px; height: 14px; }
}

/* İçerik iframe içinde (popup) gösterildiğinde */
body.modal-embed { background: #fff; }
body.modal-embed .container { margin: 0; padding: 16px; max-width: none; }
body.modal-embed .page-head { display: none; }
body.modal-embed .form-box { max-width: none; box-shadow: none; border: none; padding: 0; }

/* Büyük içerik popup'ı (Yeni Ekle / Çıkış) */
.iframe-modal { position: fixed; inset: 0; background: rgba(20,16,10,.85); display: none; align-items: center; justify-content: center; z-index: 998; padding: 16px; }
.iframe-modal.show { display: flex; }
.iframe-modal-box { background: #fff; border-radius: 20px; overflow: hidden; width: min(92vw, 460px); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.iframe-modal-head { padding: 14px 18px; background: var(--brown); color: #fff; display:flex; align-items:center; justify-content: space-between; flex-shrink: 0; }
.iframe-modal-head h3 { font-size: 14px; font-weight: 800; }
.iframe-modal-head button { background: none; border: none; color: #fff; cursor: pointer; opacity: .7; }
.iframe-modal-body { flex: 1; overflow: auto; }
.iframe-modal-body iframe { width: 100%; height: 100%; min-height: 60vh; border: none; }
