/* ========================================
   VEXTOR E-TABLO CSS
   ======================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--vx-bg);
  color: var(--vx-text);
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }

/* ── LIST PAGE ── */
.list-page {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px 0;
  min-height: 100vh;
}
.list-header {
  text-align: center; max-width: 700px; margin-bottom: 32px;
}
.list-brand {
  font-size: 0.85rem; color: var(--vx-muted); margin-bottom: 8px;
}
.list-title {
  font-size: 2.4rem; font-weight: 800; color: var(--vx-text); margin-bottom: 12px;
}
.list-sub {
  font-size: 0.9rem; color: var(--vx-muted); max-width: 600px; margin: 0 auto;
}

.list-controls {
  display: flex; gap: 12px; margin-bottom: 24px;
  width: 100%; max-width: 900px; flex-wrap: wrap;
}
.list-controls input {
  flex: 1; min-width: 200px;
  padding: 10px 16px; border: 1px solid var(--vx-border); border-radius: 6px;
  font-size: 0.875rem; font-family: inherit; outline: none; background: var(--vx-surface);
  color: var(--vx-text);
}
.list-controls input:focus { border-color: var(--vx-primary); }
.list-controls input::placeholder { color: var(--vx-muted); }
.list-controls select {
  padding: 10px 16px; border: 1px solid var(--vx-border); border-radius: 6px;
  font-size: 0.875rem; font-family: inherit; outline: none; background: var(--vx-surface);
  color: var(--vx-text); cursor: pointer;
}
.list-controls select:focus { border-color: var(--vx-primary); }

.list-table-wrap {
  width: 100%; max-width: 900px; background: var(--vx-surface);
  border: 1px solid var(--vx-border); border-radius: 8px; overflow: hidden;
  margin-bottom: 32px;
}
.list-table { width: 100%; border-collapse: collapse; }
.list-table thead tr { background: var(--vx-surface-2); }
.list-table th {
  padding: 12px 20px; text-align: left; font-size: 0.72rem; font-weight: 700;
  color: var(--vx-muted); text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--vx-border);
}
.list-table td {
  padding: 14px 20px; font-size: 0.875rem;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
}
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:hover td { background: var(--vx-surface-2); }
.org-row-name {
  display: flex; align-items: center; gap: 12px;
  color: #2563EB; font-weight: 600; cursor: pointer;
}
.org-row-name:hover { text-decoration: underline; }
.org-row-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.org-row-info { color: var(--vx-muted); font-size: 0.82rem; }

.list-footer {
  width: 100%; max-width: 900px;
  padding: 16px 0 24px;
  font-size: 0.78rem; color: var(--vx-muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.list-footer a { color: var(--vx-muted); transition: color 0.2s; }
.list-footer a:hover { color: var(--vx-primary); }
.list-footer-sep { color: #D1D5DB; }

/* ── LOGIN PAGE ── */
.etablo-page {
  min-height: 100vh;
  background: var(--vx-bg);
  display: flex; flex-direction: column;
}
.login-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px;
}
.login-card {
  background: var(--vx-surface);
  border: 1px solid var(--vx-border);
  border-radius: 12px;
  width: 100%; max-width: 680px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}
.login-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; border-bottom: 1px solid var(--vx-border);
  flex-wrap: wrap; gap: 12px;
}
.login-logo { display: flex; align-items: center; gap: 12px; }
.login-logo-title { font-size: 1rem; font-weight: 700; color: var(--vx-text); }
.login-logo-sub { font-size: 0.65rem; font-weight: 600; color: var(--vx-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.login-org-info { text-align: right; }
.login-org-name { font-size: 0.9rem; font-weight: 700; color: var(--vx-text); }
.login-org-url { font-size: 0.75rem; color: var(--vx-muted); }

.login-tabs {
  display: flex; border-bottom: 1px solid var(--vx-border);
}
.login-tab {
  flex: 1; padding: 14px; background: none; border: none; cursor: pointer;
  font-size: 0.875rem; font-weight: 600; color: var(--vx-muted); font-family: inherit;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.login-tab.active { color: #2563EB; border-bottom-color: #2563EB; background: var(--vx-tint); }
.login-tab:hover:not(.active) { background: var(--vx-surface-2); }

.tab-content { padding: 24px 28px; }
.tab-desc { font-size: 0.85rem; color: var(--vx-text); margin-bottom: 20px; line-height: 1.6; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--vx-text); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--vx-border); border-radius: 6px;
  font-size: 0.875rem; font-family: inherit; outline: none; color: var(--vx-text);
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-note { font-size: 0.75rem; color: var(--vx-muted); margin-bottom: 20px; }
.required { color: #2563EB; font-weight: 600; }
.login-error {
  background: #FEE2E2; border: 1px solid #FECACA; border-radius: 6px;
  padding: 10px 14px; font-size: 0.82rem; color: #DC2626; margin-bottom: 16px;
}
.login-actions { display: flex; gap: 12px; justify-content: center; }
.btn-back {
  padding: 10px 28px; background: var(--vx-surface-2); border: 1px solid var(--vx-border);
  border-radius: 50px; font-size: 0.875rem; font-weight: 600; cursor: pointer;
  font-family: inherit; color: var(--vx-text); transition: background 0.2s;
}
.btn-back:hover { background: var(--vx-border); }
.btn-login {
  padding: 10px 32px; background: #2563EB; color: #fff;
  border: none; border-radius: 50px; font-size: 0.875rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.2s;
}
.btn-login:hover { background: #1D4ED8; }

.help-items { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.help-items p { font-size: 0.85rem; color: var(--vx-text); line-height: 1.6; }
.help-app-note {
  background: var(--vx-tint); border: 1px solid var(--vx-border); border-radius: 8px;
  padding: 14px 16px; font-size: 0.82rem; color: var(--vx-text); margin-bottom: 20px; line-height: 1.6;
}
.help-app-link { color: #2563EB; font-weight: 600; }

.login-footer {
  width: 100%; max-width: 680px; margin-top: 20px;
  font-size: 0.75rem; color: var(--vx-muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.login-footer a { color: var(--vx-muted); }
.login-footer a:hover { color: var(--vx-primary); }

/* ── ORG SELECT ── */
.org-select-header {
  text-align: center; padding: 40px 24px 24px; background: var(--vx-bg);
}
.org-select-title { font-size: 1.1rem; font-weight: 700; color: #2563EB; margin: 8px 0 20px; }
.org-search-input {
  width: 100%; max-width: 500px; padding: 12px 20px;
  border: 1px solid var(--vx-border); border-radius: 8px; background: var(--vx-surface-2);
  font-size: 0.875rem; font-family: inherit; outline: none; color: var(--vx-muted);
  text-align: center;
}
.org-search-input:focus { border-color: #2563EB; background: var(--vx-surface); }
.org-cards {
  display: flex; flex-wrap: wrap; gap: 20px;
  padding: 24px; justify-content: center;
}
.org-card {
  background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 12px;
  padding: 24px; width: 180px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); cursor: pointer;
  transition: box-shadow 0.2s;
}
.org-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.org-card-num {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #1E90FF, #00CED1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: #fff;
}
.org-card-label { font-size: 0.875rem; font-weight: 600; color: var(--vx-text); }
.btn-goto-table {
  padding: 8px 20px; background: #2563EB; color: #fff;
  border: none; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background 0.2s;
}
.btn-goto-table:hover { background: #1D4ED8; }

/* ── SPREADSHEET ── */
.sheet-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--vx-surface); border-bottom: 1px solid var(--vx-border);
  position: sticky; top: 0; z-index: 100;
}
.sheet-org-title { font-size: 1.1rem; font-weight: 800; color: var(--vx-text); }
.btn-toggle-btns {
  padding: 8px 20px; background: #7C3AED; color: #fff;
  border: none; border-radius: 50px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.2s;
}
.btn-toggle-btns:hover { background: #6D28D9; }

.sheet-layout { display: flex; gap: 0; }
.sheet-main { flex: 1; overflow: hidden; }
.sheet-table-wrap { overflow-x: auto; }

.sheet-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.82rem;
}
.sheet-table th {
  background: var(--vx-surface-2); padding: 8px 10px;
  border: 1px solid var(--vx-border); font-size: 0.75rem; font-weight: 700;
  color: var(--vx-text); text-align: left; white-space: nowrap;
  position: sticky; top: 0; z-index: 10;
}
.sheet-table th.sortable { cursor: pointer; user-select: none; }
.sheet-table th.sortable:hover { background: var(--vx-border); }
.sheet-table td {
  border: 1px solid var(--vx-border); padding: 0;
  min-width: 40px; height: 32px;
}
.sheet-table td.fixed { padding: 4px 8px; background: var(--vx-surface-2); font-weight: 600; color: var(--vx-text); }
.sheet-table td.team-cell { padding: 4px 8px; min-width: 140px; }
.sheet-table td.tag-cell { padding: 4px 8px; min-width: 84px; }
.sheet-table td input {
  width: 100%; height: 100%; border: none; outline: none;
  padding: 4px 6px; font-size: 0.82rem; font-family: inherit;
  background: transparent; text-align: center;
}
.sheet-table td input:focus { background: var(--vx-tint); }
.sheet-table td input.error { background: #FEE2E2; color: #DC2626; }
.sheet-table td input.warn { background: #FEF9C3; }
.sheet-table tr:hover td { background: var(--vx-surface-2); }
.sheet-table tr:hover td.fixed { background: var(--vx-surface-2); }
.sheet-table td.del-cell { text-align: center; padding: 4px; cursor: pointer; color: var(--vx-muted); }
.sheet-table td.del-cell:hover { color: #EF4444; }

/* Sub-header for match columns */
.sheet-table .sub-th {
  background: var(--vx-surface-2); font-size: 0.68rem; font-weight: 600; color: var(--vx-muted);
}

/* ── SHEET INFO ── */
.sheet-info-grid {
  display: grid; grid-template-columns: 200px 1fr 160px;
  gap: 16px; padding: 20px; background: var(--vx-bg);
}
.sheet-info-card {
  background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 8px; padding: 16px;
}
.sheet-info-card h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 12px; color: var(--vx-text); }
.score-list { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--vx-text); }
.sheet-rules { padding-left: 16px; display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--vx-text); line-height: 1.5; }
.sheet-info-actions { display: flex; flex-direction: column; gap: 10px; justify-content: flex-start; padding-top: 4px; }

/* ── SHEET BUTTONS ── */
.sheet-buttons {
  width: 180px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px; background: var(--vx-bg); border-left: 1px solid var(--vx-border);
}
.btn-sheet-action {
  width: 100%; padding: 10px 12px; border: none; border-radius: 8px;
  font-size: 0.8rem; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: opacity 0.2s;
}
.btn-sheet-action:hover { opacity: 0.85; }
.btn-sheet-action.blue { background: #2563EB; color: #fff; }
.btn-sheet-action.red { background: #EF4444; color: #fff; }
.btn-sheet-action.green { background: #22C55E; color: #fff; }
.btn-sheet-action.gray { background: #6B7280; color: #fff; flex: 1; }
.btn-row { display: flex; gap: 6px; }

/* ── ZOOM ── */
.sheet-zoom {
  position: fixed; bottom: 16px; right: 16px;
  display: flex; align-items: center; gap: 8px;
  background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 50px;
  padding: 6px 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.82rem; font-weight: 600;
}
.sheet-zoom button {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  color: var(--vx-text); padding: 0 4px; line-height: 1;
}
.sheet-zoom button:hover { color: #2563EB; }

/* ── YENİ TABLO EKRANI ── */
.sheet-title-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.sheet-user { font-size: .8rem; color: var(--vx-muted); font-weight: 600; }
.sheet-status {
  font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px;
  background: #DCFCE7; color: #15803D; white-space: nowrap;
}
.sheet-status[data-durum="kaydediliyor"], .sheet-status[data-durum="bekliyor"] { background: #FEF9C3; color: #A16207; }
.sheet-status[data-durum="hata"], .sheet-status[data-durum="cevrimdisi"] { background: #FEE2E2; color: #B91C1C; }
.sheet-live { font-size: .72rem; font-weight: 700; color: #16A34A; }
.sheet-live.kopuk { color: #DC2626; }

.sheet-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  padding: 10px 20px; background: var(--vx-surface); border-bottom: 1px solid var(--vx-border);
  position: sticky; top: 61px; z-index: 99;
}
.tb-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tb-btn {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--vx-border);
  background: var(--vx-surface-2); color: var(--vx-text); font: 600 .78rem/1 inherit;
  font-family: inherit; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap;
}
.tb-btn:hover:not(:disabled) { border-color: var(--vx-primary); }
.tb-btn:focus-visible { outline: 2px solid var(--vx-primary); outline-offset: 2px; }
.tb-btn:disabled { opacity: .45; cursor: not-allowed; }
.tb-btn.primary { background: #2563EB; border-color: #2563EB; color: #fff; }
.tb-btn.warn { color: #B45309; }
.tb-btn.danger { color: #DC2626; }
.tb-info { font-size: .75rem; color: var(--vx-muted); font-weight: 600; margin-left: 4px; }

.sheet-table { width: auto; min-width: 100%; }
.sheet-table th.mac-th { text-align: center; }
.sheet-table th.col-no, .sheet-table td.col-no { width: 40px; text-align: center; }
.sheet-table th.sum-th { text-align: center; background: var(--vx-tint); }
.sheet-table td.sum-cell {
  text-align: center; padding: 4px 10px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--vx-tint); min-width: 52px;
}
.sheet-table td.sum-cell.puan { color: #2563EB; }
.sheet-table td.sum-cell.sira.ilk1 { color: #CA8A04; }
.sheet-table td.sum-cell.sira.ilk2 { color: #64748B; }
.sheet-table td.sum-cell.sira.ilk3 { color: #B45309; }
.sheet-table td input.num { min-width: 38px; font-variant-numeric: tabular-nums; }
.sheet-table td.team-cell input, .sheet-table td.tag-cell input { text-align: left; color: var(--vx-text); }
.sheet-table td input { color: var(--vx-text); }
.sheet-table td.del-cell button {
  background: none; border: none; cursor: pointer; color: var(--vx-muted); font-size: .85rem; padding: 4px 8px;
}
.sheet-table td.del-cell button:hover { color: #EF4444; }
.sheet-table td input.warn { background: #FEF9C3; color: #854D0E; }

.sheet-empty { text-align: center; padding: 48px 20px; color: var(--vx-muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sheet-empty-hint { font-size: .78rem; }

.sheet-side {
  width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px;
  padding: 16px; background: var(--vx-bg); border-left: 1px solid var(--vx-border);
}
.standings { list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow: auto; }
.standings li {
  counter-increment: s; display: flex; justify-content: space-between; gap: 8px;
  font-size: .8rem; padding: 5px 6px; border-radius: 6px;
}
.standings li:not(.st-bos)::before { content: counter(s) "."; font-weight: 700; color: var(--vx-muted); width: 22px; flex-shrink: 0; }
.standings li:nth-child(1) { background: rgba(234,179,8,.12); }
.standings li:nth-child(2) { background: rgba(148,163,184,.14); }
.standings li:nth-child(3) { background: rgba(180,83,9,.10); }
.st-ad { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.st-ad small, .st-puan small { color: var(--vx-muted); font-weight: 500; }
.st-puan { font-weight: 800; font-variant-numeric: tabular-nums; }
.st-bos { color: var(--vx-muted); }
.score-list b, .score-kill b { color: #2563EB; }
.score-kill { margin-top: 8px; font-size: .8rem; }

.sheet-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: .82rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 200; max-width: min(560px, calc(100vw - 32px));
}
.sheet-toast.acik { opacity: 1; transform: translate(-50%, 0); }
.sheet-toast[data-tur="hata"] { background: #B91C1C; }
.sheet-toast[data-tur="uyari"] { background: #A16207; }

@media (max-width: 1100px) {
  .sheet-layout { flex-direction: column; }
  .sheet-side { width: 100%; border-left: none; border-top: 1px solid var(--vx-border); display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sheet-toolbar { position: static; padding: 10px 16px; }
  .sheet-topbar { padding: 12px 16px; }
  .list-controls { flex-direction: column; }
  .login-card-header { flex-direction: column; align-items: flex-start; }
  .login-org-info { text-align: left; }
  .sheet-info-grid { grid-template-columns: 1fr; }
  .sheet-buttons { width: 100%; flex-direction: row; flex-wrap: wrap; border-left: none; border-top: 1px solid var(--vx-border); }
  .btn-sheet-action { width: auto; flex: 1; min-width: 120px; }
}
