/* =========================
   TurkNet IB - Styles
   ========================= */

:root{
  --tn-purple-1:#4b1d82;
  --tn-purple-2:#7a3db8;
  --tn-bg-1:#120322;
  --tn-bg-2:#2a0f4f;

  --card:#ffffff;
  --text:#111111;
  --muted:#6b7280;

  --btn:#6b21a8;
  --btn2:#7a3db8;
  --danger:#dc2626;

  --radius:16px;
}

*{ box-sizing:border-box; }

html,body{
  height:100%;
}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:#fff;
  background:
    radial-gradient(900px 520px at 18% 10%, rgba(122,61,184,.55), transparent 60%),
    radial-gradient(1000px 560px at 92% 30%, rgba(75,29,130,.50), transparent 62%),
    linear-gradient(135deg, var(--tn-bg-1), var(--tn-bg-2));
  min-height:100vh;
}

a{ color:inherit; text-decoration:none; }

.header{
  position:sticky;
  top:0;
  z-index:50;
  padding:10px 12px;
  background: linear-gradient(135deg, var(--tn-purple-1), var(--tn-purple-2));
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:10px;
}

.h-left{ display:flex; align-items:center; justify-content:flex-start; }
.h-right{ display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }

.logoLink{ display:flex; align-items:center; }
.logoImg{ height:30px; width:auto; display:block; }

.h-title{
  font-weight:900;
  text-align:center;
  font-size:20px;
  line-height:1.1;
  white-space:nowrap;
}

.page{
  padding:18px 12px 28px;
}

.container{
  width:min(980px, 100%);
  margin:0 auto;
}

.card{
  background: rgba(255,255,255,.92);
  color: var(--text);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}

.card + .card{ margin-top:14px; }

.centerBox{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
}

.input{
  width:min(360px, 92vw);
  padding:12px 12px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.15);
  outline:none;
  font-size:16px;
  text-align:center;
  background:#fff;
  color:#111;
}

.btn{
  border:0;
  border-radius:12px;
  padding:12px 16px;
  font-weight:800;
  cursor:pointer;
  transition:.12s;
  user-select:none;
}

.btn:active{ transform:scale(.98); }

.btn-primary{
  background: var(--btn);
  color:#fff;
}

.btn-danger{
  background: var(--danger);
  color:#fff;
}

.btn-ghost{
  background: rgba(255,255,255,.15);
  color:#fff;
  border:1px solid rgba(255,255,255,.25);
}

.btn-xs{
  padding:8px 10px;
  border-radius:10px;
  font-size:13px;
}


/* User table (home) - narrower + denser */
.tableWrap.userNarrow{
  max-width:720px;
  margin-left:auto;
  margin-right:auto;
}

table.userTable{
  font-size:14px;
}

table.userTable th,
table.userTable td{
  padding:8px 6px;
  font-size:14px;
}

table.userTable th:nth-child(1),
table.userTable td:nth-child(1){
  text-align:left;
  padding-left:12px;
}

@media (max-width: 640px){
  .tableWrap.userNarrow{ max-width:100%; }
  table.userTable th,
  table.userTable td{ padding:8px 10px; }
}

.tableWrap{
  margin-top:12px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  color:#111;
  border-radius:14px;
  overflow:hidden;
}

th, td{
  border-bottom:1px solid rgba(0,0,0,.08);
  padding:10px 10px;
  text-align:center;
  font-size:15px;
}

th{
  background:#f1f1f5;
  color:#111;
  font-weight:900;
}

.trFade{
  opacity:0;
  transform: translateY(6px);
  animation: fadeIn .18s ease-out forwards;
}

@keyframes fadeIn{
  to{ opacity:1; transform: translateY(0); }
}

/* Admin look */
.adminBody .card{
  background: rgba(255,255,255,.95);
}

/* Confirm modal */
.confirmOverlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.40);
  z-index:9999;
  padding:18px;
}

.confirmBox{
  width:min(360px, 92vw);
  background:#fff;
  color:#111;
  border-radius:14px;
  padding:16px;
  box-shadow:0 18px 40px rgba(0,0,0,.30);
}

.confirmTitle{
  font-weight:900;
  text-align:center;
  margin:0 0 12px;
}

.confirmBtns{
  display:flex;
  gap:10px;
  justify-content:center;
}

.confirmBtns .btn{
  flex:1 1 0;
}

/* "Hayır" görünür olsun */
.btn-no{
  background:#dc2626;
  color:#fff;
}

/* Admin tables */
.tdActions{
  display:flex;
  gap:8px;
  justify-content:center;
  flex-wrap:wrap;
}

.tdWrap{
  max-width:520px;
  white-space:normal;
  word-break:break-word;
}

/* ---- MOBILE HEADER LAYOUT ---- */
@media (max-width: 640px){
  .header{
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "left right"
      "title title";
  }
  .h-left{ grid-area:left; }
  .h-right{ grid-area:right; justify-content:flex-end; }
  .h-title{
    grid-area:title;
    font-size:19px;
    white-space:normal;
  }
  .logoImg{ height:34px; }
}

/* --- Mobile responsive tables (NO horizontal scroll) --- */


/* User table: narrow layout without changing typography */
.user-table-wrap{
  max-width: 920px;
  margin-inline: auto;
}
@media (max-width: 640px){
  .user-table-wrap{
    max-width: 100%;
  }
}

/* ===== V23 canonical fixes: titles + login dropdown (no header shift, no overflow) ===== */
.sectionTitle,
#queueTitle{
  display:block;
  width:100%;
  text-align:center !important;
  font-weight:900 !important;
  color:#111 !important;
  margin:10px 0 12px;
}

body{ overflow-x:hidden; }

.authAnchor{
  position:relative !important;
  display:inline-flex !important;
  align-items:center !important;
}

/* dropdown hidden unless open */
.authPopover{ display:none; }
.authAnchor.open .authPopover{ display:block !important; }

.authPopover{
  position:absolute !important;
  top:calc(100% + 8px) !important;
  right:0 !important;
  left:auto !important;

  width:min(300px, 92vw) !important;
  max-width:calc(100vw - 24px) !important;

  background:rgba(255,255,255,.98) !important;
  border:1px solid rgba(0,0,0,.10) !important;
  border-radius:14px !important;
  padding:10px !important;

  box-shadow:0 18px 50px rgba(0,0,0,.25) !important;
  z-index:800 !important;
  backdrop-filter: blur(10px);
}

.authPopoverHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.authPopoverTitle{ font-weight:900; color:#111; }
.authLabel{ display:block; font-size:12px; font-weight:700; color:#333; margin:8px 0 6px; }
.authPopover input.input{ width:100%; }
.authRow{ display:flex; align-items:center; gap:8px; margin-top:8px; color:#111; }
.authErr{ margin-top:8px; font-size:12px; color:#b00020; }

/* Mobile: no horizontal scroll for user queue table */
@media (max-width: 640px){
  .tableWrap{ overflow-x:hidden !important; }
  table.userTable{
    table-layout:fixed;
    width:100%;
  }
  table.userTable th,
  table.userTable td{
    padding:8px 6px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  table.userTable th:nth-child(1),
  table.userTable td:nth-child(1){ width:58%; text-align:left; }
  table.userTable th:nth-child(2),
  table.userTable td:nth-child(2){ width:21%; text-align:center; }
  table.userTable th:nth-child(3),
  table.userTable td:nth-child(3){ width:21%; text-align:center; }
}

/* Admin: Aktif Mola title row + back button */
.adminActionsRow{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}
.adminActionsTitle{
  text-align:center !important;
  font-weight:900 !important;
  color:#111 !important;
}
.adminActionsRow > :first-child{ justify-self:start; }
.adminActionsRow > :last-child{ justify-self:end; }

#btnUndo{
  background: linear-gradient(135deg, var(--btn), var(--btn2));
  color:#fff;
  border:1px solid rgba(255,255,255,.25);
}
#btnUndo:hover{ filter: brightness(1.03); }

.adminBody .card + .card{ margin-top:10px !important; }

/* V25: Mobile queue row in a single line (name + time + date) */
@media (max-width: 640px){
  table.userTable thead{ display:table-header-group !important; } /* keep like desktop */
  table.userTable th:nth-child(2),
  table.userTable th:nth-child(3),
  table.userTable td:nth-child(2),
  table.userTable td:nth-child(3){
    display:none !important;
  }

  table.userTable td:nth-child(1){
    width:100% !important;
    white-space:nowrap;
  }

  table.userTable td:nth-child(1) .mInline{
    display:inline-flex;
    align-items:center;
    gap:10px;
    margin-left:10px;
    vertical-align:middle;
  }
  table.userTable td:nth-child(1) .mTime,
  table.userTable td:nth-child(1) .mDate{
    font-weight:700;
    color:#111;
  }

  /* if it doesn't fit, hide date first */
  @media (max-width: 380px){
    table.userTable td:nth-child(1) .mDate{ display:none; }
  }
}

.mInline{ display:none; }
@media (max-width: 640px){ .mInline{ display:inline-flex; } }

/* ===== V26: iOS Chrome/Safari mobile table consistency (force classic table) ===== */

/* ===== V27: Clean mobile tables (no card layout anywhere) ===== */
@media (max-width: 640px){
  table.userTable{
    display:table !important;
    width:100% !important;
    table-layout:fixed !important;
  }
  table.userTable thead{ display:table-header-group !important; }
  table.userTable tbody{ display:table-row-group !important; }
  table.userTable tr{ display:table-row !important; }
  table.userTable th,
  table.userTable td{
    display:table-cell !important;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    vertical-align:middle;
    padding:8px 6px;
  }
  table.userTable th:nth-child(1),
  table.userTable td:nth-child(1){ width:50% !important; }
  table.userTable th:nth-child(2),
  table.userTable td:nth-child(2){ width:25% !important; text-align:center; }
  table.userTable th:nth-child(3),
  table.userTable td:nth-child(3){ width:25% !important; text-align:center; }
}

/* ===== V27: Queue table header alignment (İsim left, Saat center, Tarih right) ===== */
table.userTable thead th:nth-child(1){ text-align:left !important; padding-left:12px; }
table.userTable thead th:nth-child(2){ text-align:center !important; }
table.userTable thead th:nth-child(3){ text-align:right !important; padding-right:12px; }

/* Keep row alignment consistent with header (safe, only affects this table) */
table.userTable tbody td:nth-child(1){ text-align:left !important; padding-left:12px; }
table.userTable tbody td:nth-child(2){ text-align:center !important; }
table.userTable tbody td:nth-child(3){ text-align:right !important; padding-right:12px; }

/* ===== V27: userTable fixed layout to prevent shifting when rows appear ===== */
table.userTable{ table-layout: fixed; }
