/* WinDay Admin — additions on top of the shared style.css design system. */

/* The public site blocks text selection/right-click — the admin panel needs both. */
body, * { -webkit-user-select: text !important; -moz-user-select: text !important; user-select: text !important; }

.admin-shell { display: none; }
/* Fixed (not min-) height — this is what makes .tab-bar's overflow-y:auto actually kick in
   below, instead of the whole page growing taller than the viewport and scrolling as one
   block (which pushed the sidebar's bottom entries out of reach). */
.admin-shell.visible { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-l);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--black-card);
  border: 1px solid var(--white-08);
  border-radius: var(--radius-l);
  padding: var(--gap-l);
  box-shadow: var(--shadow-card);
}
.login-card .brand { justify-content: center; margin-bottom: var(--gap-l); }
.login-card .brand img { height: 40px; }
.login-card .brand-word { font-size: 26px; }

.admin-header {
  flex: 0 0 auto;
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: 50px;
  padding: 0 var(--gap-m);
  background: var(--black-soft);
  border-bottom: 1px solid var(--white-08);
}
.admin-header .who { font-size: 12.5px; color: var(--white-45); }
.admin-header .brand-word { font-size: 15px; }
#btn-sidebar-toggle { display: none; }

/* Sidebar + content, side by side below the top bar — the WordPress admin layout,
   kept in this project's existing dark palette (no new colors introduced). */
.admin-body { flex: 1 1 auto; display: flex; min-height: 0; }

.admin-sidebar-backdrop { display: none; }

.tab-bar {
  flex: 0 0 220px;
  width: 220px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--black-soft);
  border-right: 1px solid var(--white-08);
  scrollbar-width: thin;
  scrollbar-color: var(--white-12) transparent;
}
.tab-bar::-webkit-scrollbar { width: 8px; }
.tab-bar::-webkit-scrollbar-thumb { background: var(--white-12); border-radius: var(--radius-pill); }
.tab-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--white-65);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.tab-btn svg { flex: 0 0 auto; width: 17px; height: 17px; }
.tab-btn:hover { background: var(--white-08); color: var(--white-85); }
.tab-btn.active { background: var(--black-elevated); border-left-color: var(--blue); color: var(--white); font-weight: 700; }

.admin-content { flex: 1 1 auto; min-width: 0; overflow-y: auto; }
.admin-panel { display: none; padding: var(--gap-m); }
.admin-panel.active { display: block; }

@media (max-width: 899px) {
  #btn-sidebar-toggle { display: flex; }
  .tab-bar {
    position: fixed;
    top: 50px; left: 0; bottom: 0;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.5);
  }
  .tab-bar.open { transform: translateX(0); }
  .admin-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 50px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 44;
  }
  .admin-sidebar-backdrop.open { display: block; }
}

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-s); margin-bottom: var(--gap-l); }
.stat-tile {
  background: var(--black-card);
  border: 1px solid var(--white-08);
  border-radius: var(--radius-m);
  padding: 14px;
}
.stat-tile .val { font-size: 22px; font-weight: 800; color: var(--blue-light); font-variant-numeric: tabular-nums; }
.stat-tile .lbl { font-size: 11px; color: var(--white-45); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }

.alert-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-s); margin-bottom: var(--gap-l); }
.alert-tile {
  display: flex; align-items: center; gap: 12px;
  background: var(--black-card);
  border: 1px solid var(--white-08);
  border-radius: var(--radius-m);
  padding: 14px;
  cursor: pointer;
}
.alert-tile .val { font-size: 22px; font-weight: 800; color: var(--white-45); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.alert-tile.due .val { color: #FF8080; }
.alert-tile .lbl { font-size: 12px; color: var(--white-65); line-height: 1.3; }
@media (min-width: 720px) { .alert-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .alert-grid { grid-template-columns: repeat(5, 1fr); } }

.lottery-control-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap-s); }
@media (min-width: 600px) { .lottery-control-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .lottery-control-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .lottery-control-grid { grid-template-columns: repeat(4, 1fr); } }
.lottery-control-card { background: var(--black-card); border: 1px solid var(--white-08); border-radius: var(--radius-m); padding: 14px; }
.lottery-control-card .name { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.lottery-control-card .participants { font-size: 13px; font-weight: 700; color: #4ADE80; margin-bottom: 8px; }
.lottery-control-card .before-draw-label { color: #FF8A3D; font-weight: 700; font-size: 13px; }
.lottery-control-card .before-draw-track { height: 4px; background: var(--white-08); border-radius: var(--radius-pill); overflow: hidden; margin-top: 6px; }
.lottery-control-card .before-draw-fill { height: 100%; background: #FF8A3D; border-radius: var(--radius-pill); transition: width 0.4s ease; }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--gap-m); gap: 10px; }
.panel-head h2 { font-size: 17px; font-weight: 800; }

.table-wrap { overflow-x: auto; border: 1px solid var(--white-08); border-radius: var(--radius-m); background: var(--black-card); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--white-08); }
table.data-table th { color: var(--white-45); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table td.actions { display: flex; gap: 6px; }

.pill { display: inline-block; padding: 3px 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.pill-on { background: rgba(0,120,255,0.18); color: var(--blue-light); }
.pill-off { background: rgba(255,255,255,0.08); color: var(--white-45); }

.search-row { display: flex; gap: 8px; margin-bottom: var(--gap-m); }
.search-row input { flex: 1; }

.btn-danger { background: rgba(255,80,80,0.15); color: #FF8080; border: 1px solid rgba(255,80,80,0.3); }
.btn-icon-sm { height: 30px; padding: 0 10px; font-size: 11.5px; border-radius: var(--radius-pill); border: 1px solid var(--white-12); background: var(--black-elevated); color: var(--white-85); cursor: pointer; font-weight: 700; }
.btn-icon-sm.due { background: #3DD68C; border-color: #3DD68C; color: #06070A; }

@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
  .admin-panel { padding: var(--gap-l) var(--gap-xl); }
}

.product-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.product-gallery .gallery-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--black-elevated);
  border: 1px solid var(--white-08);
}
.product-gallery .gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-gallery .gallery-tile .gallery-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #FF8080;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.product-gallery .gallery-tile .gallery-cover-badge {
  position: absolute;
  bottom: 2px; left: 2px;
  background: var(--blue);
  color: var(--white);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
}

.search-row select {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-m);
  background: var(--black-elevated);
  border: 1px solid var(--white-12);
  color: var(--white);
  font-size: 13.5px;
}

.hero-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.hero-photo-grid .hero-photo-tile {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--black-elevated);
  border: 1px solid var(--white-08);
}
.hero-photo-grid .hero-photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-photo-grid .hero-photo-tile .hero-photo-label {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(0,0,0,0.65);
  color: var(--white);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
}
.hero-photo-grid .hero-photo-tile .hero-photo-change {
  position: absolute;
  bottom: 6px; left: 6px; right: 6px;
  height: 30px;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(0,0,0,0.7);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

#user-search-clear { flex-shrink: 0; white-space: nowrap; }
#user-search { flex: 0 1 280px; }

.data-table a[href^="mailto:"] { color: var(--blue-light); text-decoration: none; }
.data-table a[href^="mailto:"]:hover { text-decoration: underline; }

.world-map-viewport {
  position: relative;
  width: 100%;
  max-height: 480px;
  overflow: auto;
  border-radius: var(--radius-m);
  border: 1px solid var(--white-08);
  background: #0b1220;
}
.world-map-zoom { position: relative; width: 100%; }
.world-map-bg svg {
  display: block;
  width: 100%;
  height: auto;
}
.world-map-bg svg path {
  fill: rgba(255, 255, 255, 0.07);
  stroke: rgba(120, 170, 255, 0.55);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}
.world-map-markers { position: absolute; inset: 0; }
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: default;
}
.map-marker .flag-icon { width: 20px; height: 15px; box-shadow: 0 0 0 2px #0b1220, 0 1px 4px rgba(0,0,0,0.6); }
.map-marker .map-marker-count {
  background: var(--blue);
  color: var(--white);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  padding: 2px 5px;
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 4px rgba(0,0,0,0.6);
  white-space: nowrap;
}
.world-map-empty { padding: var(--gap-l); text-align: center; color: var(--white-45); font-size: 13px; }
.map-zoom-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--white-45);
  font-size: 15px;
}

/* Rich text editor (mass-email body / signature) */
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rte-toolbar .btn { min-width: 34px; padding-left: 10px; padding-right: 10px; }
.rte-editor {
  width: 100%;
  min-height: 180px;
  max-height: 420px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: var(--radius-m);
  background: var(--black-elevated);
  border: 1px solid var(--white-12);
  color: var(--white);
  font-size: 13.5px;
  line-height: 1.5;
}
.rte-editor:empty::before { content: attr(data-placeholder); color: var(--white-45); }
.rte-editor img { max-width: 100%; border-radius: var(--radius-s); cursor: pointer; }
.rte-editor img.rte-img-selected { outline: 2px solid var(--blue); outline-offset: 2px; }
.rte-editor a { color: var(--blue-light); }
.rte-toolbar-sep { width: 1px; align-self: stretch; background: var(--white-12); margin: 2px 2px; }
.rte-size-active { background: var(--blue) !important; border-color: var(--blue) !important; color: var(--white) !important; }
.map-zoom-control input[type="range"] { flex: 1; }
