/* 01-base-and-rotations-cards.css
   Reset, page layout, and the Rotations hub's card, timer and role-modal styles.
   Files in css/ load in filename order and the cascade depends on it: see docs/CSS.md. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("assets/fonts/PlusJakartaSans-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

/* ============================================================
   BASE THEME
============================================================ */
:root {
  --bg: #0f1220;
  --card: #171a2b;
  --text: #eef6fb;
  --muted: #8ea3b0;
  --accent: rgba(77, 163, 255, 0.35);

  --role-ot: #4da3ff;
  --role-ipos: #b57bff;
  --role-mc: #168347;
  --role-door-expo: #ffcc66;
  --role-traffic: #ff6f6f;
  --leader: #e51636;

  --inside: #1a2c46;
  --outside: #3f7d4a;
  --cover: #ff4d4f;
  --line: #222b47;
}

/* ============================================================
   GLOBAL
============================================================ */
.icon-btn,
.move-icon,
.cover-icon,
.pause-icon {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif !important;
}

/* ============================================================
   REMOVE BLUE HIGHLIGHT FROM BUTTON CLICKS / TOUCHES
============================================================ */
*:focus {
  outline: none !important;
}

button,
.icon-btn,
.mini-end-btn,
.modal-btn,
.toggle-btn,
.cover-name-pill,
.adjust-btn {
  outline: none !important;
  box-shadow: none !important;
}

/* Remove Chrome/Android tap highlight */
* {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   FORCE NO SCROLLBARS ANYWHERE
============================================================ */
* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none !important;
}

.column,
#app,
.card-list {
  min-height: 0;
  min-width: 0;
  overflow: visible; /* allow stacking */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Plus Jakarta Sans",
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-variant-numeric: tabular-nums;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* Keep the pointer stable while it crosses text/icons inside clickable controls. */
button,
[role="button"],
label:has(input[type="radio"]),
label:has(input[type="checkbox"]),
summary {
  user-select: none;
  -webkit-user-select: none;
}

button *,
[role="button"] *,
label:has(input[type="radio"]) *,
label:has(input[type="checkbox"]) *,
summary * {
  cursor: inherit;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none !important;
}

/* Main layout: Inside 50%, Outside 50% */
#app {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  width: 100%;
}

.column {
  width: 50%;
  padding: 0 10px;
}

.column-title {
  text-align: center;
  font-weight: 900;
  font-size: 22px;
  color: var(--muted);
  margin-bottom: 14px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ============================================================
   CARD BASE
============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  position: relative;
  z-index: 1;
  overflow: visible;
  padding-right: 15px;
  min-height: 87px;
  height: auto;
}

/* ============================================================
   STATUS BAR
============================================================ */
.status-bar {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 32px;
  height: 100%;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* This element rotates 180°, so these become right-side corners visually. */
  border-radius: 14px 0 0 14px;
}

.status-inside {
  background: var(--inside);
}
.status-outside {
  background: var(--outside);
}
.status-cover {
  background: var(--cover);
}
.status-off-soon {
  background: #d85b91;
}

.status-bar.role-change-edge {
  cursor: pointer;
  font-size: 9px;
  letter-spacing: 0.6px;
}

.status-bar.role-change-edge:hover {
  filter: brightness(1.12);
}

.status-bar.split-role-edge {
  writing-mode: horizontal-tb;
  transform: none;
  border-radius: 0 14px 14px 0;
}

.role-edge-words {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  transform: rotate(-90deg);
  font-size: 13px;
  line-height: 0.9;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.role-edge-word {
  display: block;
}

.secondary-status-bar {
  display: none;
  font-size: 12px;
  letter-spacing: 2px;
}

.card.dual-status .status-bar:not(.secondary-status-bar) {
  right: 32px;
  border-radius: 0;
}

.card.dual-status .card-header-grid {
  width: calc(100% - 64px);
}

/* ============================================================
   HEADER GRID
============================================================ */
.card-header-grid {
  display: grid;
  grid-template-columns: 32% 35% 10% 0% 23%;
  align-items: center;
  gap: 0px;
  width: calc(100% - 32px);
  min-height: 71px;
}

/* ============================================================
   ROLE PILL / NAME / SHIFT
============================================================ */
.col-role-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: stretch;
  justify-content: center;
}

.role-pill {
  display: inline-block;
  width: fit-content;
  padding: 3px 8px;
  white-space: nowrap;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.role-Order-Taker {
  background: var(--role-ot);
}
.role-iPOS-Lead {
  background: var(--role-ipos);
}
.role-Mobile-Cash {
  background: var(--role-mc);
}
.role-Door-Expo {
  background: var(--role-door-expo);
}
.role-Traffic {
  background: var(--role-traffic);
}

.card-name {
  font-size: 20px;
  font-weight: 800;
}

.card.leader-card .card-name {
  color: var(--leader);
}

.card-shift {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   HISTORY
============================================================ */
.col-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-self: stretch;
  justify-content: center;
  overflow: hidden;
  align-items: flex-start;
}

.history-row {
  background: #1e2b33;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--muted);
  opacity: 0.95;
  display: inline-block;
  width: auto;
}

/* ============================================================
   ICON BUTTONS
============================================================ */
.col-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: stretch;
  justify-content: center;
  align-items: center;
  margin-top: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #22283f;
  border: 1px solid #303a55;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #2d3552;
}

/* ============================================================
   TIMER
============================================================ */
.col-timer {
  font-size: 26px;
  font-weight: 900;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  align-self: stretch;
  gap: 8px;
}

.exposure-rating {
  display: flex;
  justify-content: flex-end;
  gap: 0;
  height: 10px;
  font-size: clamp(10px, 1.15vw, 16px);
  line-height: 10px;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  min-width: 28px;
}

.exposure-rating:empty {
  display: none;
}

.exposure-rating span {
  display: inline-block;
}

/* ===============================
   MINI-CARD WRAPPER
================================ */
.mini-card-wrapper {
  margin-top: 10px;
  display: none;
  position: relative;
}

.mini-card-wrapper.has-mini {
  display: block;
}

/* MINI-CARD GRID */
.mini-card {
  display: grid;
  grid-template-columns: 45% 35% 20%;
  width: 70%;
  height: 48px;
  margin-left: auto;
  margin-right: 26px;
  gap: 6px;
  padding: 8px 10px;
  background: #0f162d;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.mini-card > * {
  min-width: 0 !important;
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* COLUMN 1 — NAME */
.mini-name {
  font-size: 16px;
  font-weight: 900;
  justify-content: flex-start;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* COLUMN 2 — END COVER BUTTON */
.mini-end-btn {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff4d4f;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 900;
  color: var(--text);
  padding: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.mini-end-btn:hover {
  opacity: 0.85;
}

/* COLUMN 3 — TIMER */
.mini-timer {
  font-size: 20px;
  font-weight: 900;
  justify-content: flex-end;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  margin-right: 16px;
}

/* Outer horizontal row — label flush against mini-card */
.mini-cover-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  margin-right: 26px;
}

.mini-cover-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  width: 30%;
  margin: 0;
  padding: 0;
  text-align: right;
}

/* Pause icon for main card during cover */
.pause-icon {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
}

.pause-icon.pulsing {
  animation: pausePulse 1.1s ease-in-out infinite;
}

@keyframes pausePulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.14);
    opacity: 0.65;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================================
   MODALS
============================================================ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10500000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-box {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 20px;
  width: 300px;
  transform: scale(0.92) translateY(10px);
  opacity: 0;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}

.modal:not(.hidden) .modal-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal.hidden .modal-box {
  transform: scale(0.92) translateY(10px);
  opacity: 0;
}

/* Mobile browsers can duplicate transformed card layers when backdrop-filter
   samples them. Blur the stable page containers instead on phone portrait. */
body[data-layout="phone-portrait"] .modal {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(15, 18, 32, 0.62);
}

body[data-layout="phone-portrait"].modal-open {
  overflow: hidden;
}

body[data-layout="phone-portrait"].modal-open #weather-row,
body[data-layout="phone-portrait"].modal-open #app {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

/* ROLE MODAL BUTTONS */
.role-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.role-btn {
  width: 100%;
  padding: 8px 12px;
  height: 44px;
  border-radius: 10px;
  border: none;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
  margin-bottom: 6px;
}

.role-btn:hover {
  opacity: 0.9;
}

.role-btn.role-Order-Taker {
  background: var(--role-ot);
}
.role-btn.role-iPOS-Lead {
  background: var(--role-ipos);
}
.role-btn.role-Mobile-Cash {
  background: var(--role-mc);
}
.role-btn.role-Door-Expo {
  background: var(--role-door-expo);
}
.role-btn.role-Traffic {
  background: var(--role-traffic);
}

.modal-cancel {
  width: 100%;
  padding: 10px 14px;
  height: 44px;
  background: #22283f;
  border: 1px solid #303a55;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.modal-cancel:hover {
  background: #2d3552;
}

/* ============================================================
   COVER MODAL
============================================================ */
.cover-name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  justify-items: center;
  margin-top: 16px;
}

.cover-name-pill {
  background: #2a334a;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  width: 100%;
  max-width: 160px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.cover-name-pill:hover {
  opacity: 0.85;
}

.cover-toggle-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #1e2539;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  height: 44px;
}

.cover-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  border-radius: 12px;
  transition: transform 0.25s ease;
  z-index: 0;
  background: var(--accent);
}

.toggle-btn {
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn.active {
  color: white;
}

.cover-cancel-btn {
  width: 100%;
  padding: 12px;
  margin-top: 20px;
  background: #22283f;
  border: 1px solid #303a55;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.cover-cancel-btn:hover {
  opacity: 0.85;
}

/* ============================================================
   ADJUST TIMER MODAL
============================================================ */
.adjust-box {
  width: 320px;
}

.adjust-toggle-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #1e2539;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  height: 44px;
}

.adjust-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: var(--accent);
  border-radius: 12px;
  transition: transform 0.22s ease;
  z-index: 1;
}

.adjust-toggle-btn {
  position: relative;
  z-index: 2;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.adjust-toggle-btn.active {
  color: white;
}

.adjust-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.adjust-btn {
  width: 100%;
  padding: 10px 14px;
  height: 44px;
  background: var(--accent);
  border: 1px solid #303a55;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.adjust-btn:hover {
  background: #2d3552;
}

/* ============================================================
   ADJUST EXPOSURE MODAL
============================================================ */

.exposure-box {
  width: min(340px, calc(100vw - 40px));
  text-align: center;
}

.exposure-modal-value {
  min-height: 42px;
  margin: 14px 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
}

.exposure-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.exposure-adjust-btn {
  height: 52px;
  border: 1px solid #3a456d;
  border-radius: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.exposure-minus {
  background: #386b9d;
}

.exposure-plus {
  background: #a44545;
}

.exposure-adjust-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.adjust-toggle-btn,
.adjust-btn,
#adjust-cancel {
  -webkit-tap-highlight-color: transparent;
}

#inside-list,
#outside-list {
  padding-bottom: 70px;
  position: relative;
}

/* ===========================================
   FULL SCREEN LOADING OVERLAY
=========================================== */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  opacity: 1;
}

#loading-screen.hidden {
  display: none;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000000;
  display: grid;
  place-items: start center;
  padding: 22px;
  background: radial-gradient(circle at top, rgba(88, 101, 242, 0.18), transparent 38%), #111214;
  /* Keep login input responsive: this layer is already effectively opaque,
     so blurring the animated dashboard underneath only adds repaint work. */
  backdrop-filter: none;
  overflow: hidden;
}

.auth-screen.hidden {
  display: none;
}
