*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

:root {
  --teal-header: #0a5c5c;
  --teal-dark: #084f4f;
  --teal-accent: #0a5c5c;
  --bg-page: #eef2f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: #d1d5db;
  --red: #e62e4d;
  --active-bg: #e0f2fe;
  --active-text: #0a5c5c;
}

html,
body {
  min-height: 100%;
}

body.clients-app,
body.games-app {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-page);
  padding-bottom: 72px;
}

.clients-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--teal-header);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.clients-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.clients-header__logo-wrap {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.clients-header__logo {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 27%;
  overflow: visible;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 12px rgba(147, 51, 234, 0.55),
    0 0 22px rgba(99, 102, 241, 0.35),
    0 0 32px rgba(147, 51, 234, 0.2);
  animation: clients-logo-glow 2.4s ease-in-out infinite;
}

.clients-header__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 27%;
}

.clients-header__glow {
  position: absolute;
  inset: -6px;
  border-radius: 32%;
  background: radial-gradient(
    circle at center,
    rgba(147, 51, 234, 0.45) 0%,
    rgba(99, 102, 241, 0.22) 40%,
    transparent 70%
  );
  animation: clients-logo-pulse 2.4s ease-out infinite;
  pointer-events: none;
  z-index: 0;
}

.clients-header__glow--delay {
  animation-delay: 1.2s;
}

.clients-header__live {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  z-index: 2;
}

.clients-header__live-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #22c55e;
  border: 1.5px solid #0a3d3d;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.9);
  animation: clients-live-dot 1.8s ease-in-out infinite;
}

.clients-header__live-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(34, 197, 94, 0.8);
  animation: clients-live-ring 1.8s ease-out infinite;
}

.clients-header__live-ring--delay {
  animation-delay: 0.9s;
}

@keyframes clients-logo-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.1),
      0 0 10px rgba(147, 51, 234, 0.45),
      0 0 18px rgba(99, 102, 241, 0.28),
      0 0 28px rgba(147, 51, 234, 0.15);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.14),
      0 0 16px rgba(147, 51, 234, 0.7),
      0 0 28px rgba(99, 102, 241, 0.45),
      0 0 40px rgba(147, 51, 234, 0.28);
  }
}

@keyframes clients-logo-pulse {
  0% {
    opacity: 0.75;
    transform: scale(0.85);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes clients-live-ring {
  0% {
    transform: scale(0.85);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

@keyframes clients-live-dot {
  0%,
  100% {
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow: 0 0 12px rgba(34, 197, 94, 1);
    transform: translate(-50%, -50%) scale(1.12);
  }
}

.clients-header h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.clients-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.clients-header__refresh {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.clients-header__refresh svg {
  width: 18px;
  height: 18px;
}

.clients-main {
  padding: 10px 6px;
  max-width: 100%;
}

.clients-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.clients-card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.clients-form-card {
  padding: 14px 14px 16px;
}

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

.clients-card__head h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--teal-accent);
}

.clients-card__close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.clients-card__close svg {
  width: 18px;
  height: 18px;
}

.client-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-field__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.client-field__label small {
  font-weight: 600;
  color: var(--muted);
}

.client-field input {
  width: 100%;
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.client-field input::placeholder {
  color: #94a3b8;
  font-weight: 600;
}

.client-field input:focus {
  border-color: var(--teal-accent);
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(10, 92, 92, 0.18);
}

.client-field input.input-upper {
  text-transform: uppercase;
}

.client-message {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
}

.client-message.success {
  background: #ecfdf5;
  color: #047857;
}

.client-message.error {
  background: #fef2f2;
  color: #b91c1c;
}

.client-message.hidden {
  display: none;
}

.btn-save-client {
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--teal-header);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-save-client:hover {
  background: var(--teal-dark);
}

.clients-list-card {
  padding: 14px;
}

.clients-list__title {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--teal-accent);
  margin-bottom: 12px;
}

.clients-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.clients-list__empty {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  padding: 16px 8px;
}

.clients-list__empty.hidden {
  display: none;
}

.client-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.client-item.is-editing {
  border-color: #0a5c5c;
  box-shadow: 0 0 0 3px rgba(10, 92, 92, 0.16);
}

.client-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.client-item__body {
  flex: 1;
  min-width: 0;
}

.client-item__name {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.client-item__meta {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.45;
}

.client-item__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.client-item__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--active-bg);
  color: var(--active-text);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.client-item__badge--locked {
  background: #fff7ed;
  color: #c2410c;
}

.client-item__delete.is-locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.client-item__delete {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  flex-shrink: 0;
}

.client-item__delete svg {
  width: 20px;
  height: 20px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 8px 4px 10px;
  background: var(--teal-header);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-item__icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.nav-item__icon--jantri {
  -webkit-mask-image: url("../assets/icons/game.svg");
  mask-image: url("../assets/icons/game.svg");
}

.nav-item__icon--cutting {
  -webkit-mask-image: url("../assets/icons/cutting.svg");
  mask-image: url("../assets/icons/cutting.svg");
}

.nav-item__icon--result {
  -webkit-mask-image: url("../assets/icons/result.svg");
  mask-image: url("../assets/icons/result.svg");
}

.nav-item__icon--hisab {
  -webkit-mask-image: url("../assets/icons/hisab.svg");
  mask-image: url("../assets/icons/hisab.svg");
}

.nav-item__icon--lenden {
  -webkit-mask-image: url("../assets/icons/lenden.svg");
  mask-image: url("../assets/icons/lenden.svg");
}

.nav-item__icon--delete {
  -webkit-mask-image: url("../assets/icons/delete.svg");
  mask-image: url("../assets/icons/delete.svg");
}

.nav-item__icon--menu {
  -webkit-mask-image: url("../assets/icons/menu.svg");
  mask-image: url("../assets/icons/menu.svg");
}

@media (min-width: 900px) {
  body.clients-app,
body.games-app {
    padding-bottom: 80px;
  }

  .clients-header {
    padding: 12px 16px;
  }

  .clients-header h1 {
    font-size: 1.15rem;
  }

  .clients-main {
    padding: 12px 10px;
  }

  .clients-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 14px;
    align-items: start;
  }

  .clients-form-card {
    position: sticky;
    top: 58px;
  }

  .clients-list {
    gap: 12px;
  }

  .client-item {
    padding: 14px;
  }

  .nav-item {
    font-size: 0.65rem;
  }

  .nav-item__icon {
    width: 22px;
    height: 22px;
  }
}

@media (min-width: 1200px) {
  .clients-main {
    padding: 14px 12px;
  }

  .clients-layout {
    gap: 16px;
  }

  .client-field input {
    height: 44px;
  }
}

@media (max-width: 380px) {
  .clients-header h1 {
    font-size: 0.95rem;
  }

  .client-item__meta {
    font-size: 0.68rem;
  }
}

body.confirm-open {
  overflow: hidden;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.confirm-modal[hidden] {
  display: none !important;
}

.confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 32, 32, 0.55);
}

.confirm-modal__panel {
  position: relative;
  width: min(360px, 100%);
  padding: 22px 18px 16px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
  text-align: center;
}

.confirm-modal__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #fef2f2;
  color: var(--red);
}

.confirm-modal__icon svg {
  width: 24px;
  height: 24px;
}

.confirm-modal__panel h3 {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.confirm-modal__panel p {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 18px;
}

.confirm-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confirm-modal__btn {
  height: 42px;
  border: none;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.confirm-modal__btn--cancel {
  background: #eef2f6;
  color: #334155;
}

.confirm-modal__btn--danger {
  background: var(--red);
  color: #fff;
}
