/* Star Gallery attendance - bright brand theme (green / red / white) */
:root {
  --brand-green: #00a651;
  --brand-green-dark: #00773a;
  --brand-green-soft: #e6f7ee;
  --brand-red: #e0232e;
  --brand-red-soft: #fdecec;
  --ink: #17301f;
  --ink-soft: #5b6f62;
  --line: #dcefe4;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(0, 90, 45, 0.10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Tajawal', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(0, 166, 81, 0.14), transparent 60%),
    radial-gradient(700px 420px at 8% 108%, rgba(224, 35, 46, 0.08), transparent 55%),
    linear-gradient(180deg, #f4fbf7 0%, #eef8f2 45%, #fdfdfd 100%);
  min-height: 100vh;
}

/* ---------- Header ---------- */
.header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 22px;
  background: linear-gradient(120deg, var(--brand-green-dark), var(--brand-green) 60%, #19c06a);
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 119, 58, 0.28);
  border-radius: 0 0 22px 22px;
}
.header h1 { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.header .who { font-size: 14px; margin-inline-end: 10px; opacity: .95; }
.header-logo {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  border: 2px solid rgba(255,255,255,.85);
}

/* ---------- Layout ---------- */
.container { max-width: 980px; margin: 26px auto 60px; padding: 0 16px; display: grid; gap: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 17px; font-weight: 800; margin-bottom: 14px;
  background: linear-gradient(90deg, var(--brand-green-dark), var(--brand-green));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--ink-soft); font-size: 14px; }
.mt { margin-top: 14px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: var(--ink-soft); }
input, select {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fbfefd;
  color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15);
}
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; font-family: inherit; font-size: 15px; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer; color: #fff;
  background: linear-gradient(120deg, var(--brand-green-dark), var(--brand-green));
  box-shadow: 0 4px 14px rgba(0, 140, 70, 0.30);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(0, 140, 70, 0.36); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary {
  background: #fff; color: var(--brand-green-dark);
  border: 1.5px solid var(--brand-green);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--brand-green-soft); }
.btn.danger {
  background: linear-gradient(120deg, #b8141f, var(--brand-red));
  box-shadow: 0 4px 14px rgba(224, 35, 46, 0.28);
}
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.big { padding: 18px 10px; font-size: 18px; border-radius: 16px; flex: 1; }
.btn.big .ico { font-size: 22px; }
.btn.checkin { background: linear-gradient(120deg, #00944a, #16c463); }
.btn.checkout { background: linear-gradient(120deg, #c21822, #f0512f); box-shadow: 0 4px 14px rgba(224, 60, 46, 0.30); }
.punch-row { display: flex; gap: 12px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 400px; background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 24px;
  padding: 34px 30px; box-shadow: var(--shadow); text-align: center;
}
.login-logo {
  width: 108px; height: 108px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 14px; display: block;
  box-shadow: 0 8px 24px rgba(0, 119, 58, 0.25);
  border: 3px solid #fff;
}
.login-card h1 { font-size: 22px; font-weight: 800; color: var(--brand-green-dark); }
.login-card .sub { color: var(--ink-soft); font-size: 14px; margin: 6px 0 20px; }
.login-card form { text-align: start; display: grid; gap: 10px; }
.login-card .btn { margin-top: 8px; width: 100%; }
.lang-slot { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.lang-toggle { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.lang-toggle button { padding: 6px 14px; border: none; background: transparent; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.lang-toggle button.on { background: linear-gradient(120deg, var(--brand-green-dark), var(--brand-green)); color: #fff; }
.header .lang-toggle { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.14); }
.header .lang-toggle button { color: #fff; opacity: .85; }
.header .lang-toggle button.on { background: #fff; color: var(--brand-green-dark); opacity: 1; }

/* ---------- Messages ---------- */
.msg { display: none; margin-top: 12px; padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 500; }
.msg.show { display: block; }
.msg.success { background: var(--brand-green-soft); color: var(--brand-green-dark); border: 1px solid #b7e7cb; }
.msg.error { background: var(--brand-red-soft); color: #a3131d; border: 1px solid #f5c2c5; }
.msg.info { background: #eef4ff; color: #274a8a; border: 1px solid #ccdfff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-soft); font-size: 12.5px; font-weight: 700; background: #f4fbf7; }
tr:last-child td { border-bottom: none; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Badges & chips ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.badge.in, .badge.yes { background: var(--brand-green-soft); color: var(--brand-green-dark); }
.badge.out { background: #fff3e8; color: #b45a08; }
.badge.no { background: var(--brand-red-soft); color: #a3131d; }
.stat-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 10px; }
.chip {
  border-radius: 14px; padding: 14px 10px; text-align: center;
  font-size: 24px; font-weight: 800; border: 1px solid var(--line); background: #fff;
}
.chip small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-top: 4px; }
.chip.g { color: var(--brand-green-dark); background: var(--brand-green-soft); border-color: #b7e7cb; }
.chip.r { color: #c21822; background: var(--brand-red-soft); border-color: #f5c2c5; }
.chip.b { color: #33413a; background: #eef1ef; }
.chip.d { color: #b45a08; background: #fff3e8; border-color: #f5ddc2; }

/* ---------- Days picker ---------- */
.days-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.day-pill {
  padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft);
  cursor: pointer; user-select: none; transition: all .12s;
}
.day-pill.on {
  background: linear-gradient(120deg, var(--brand-green-dark), var(--brand-green));
  color: #fff; border-color: transparent;
  box-shadow: 0 3px 10px rgba(0, 140, 70, 0.30);
}

/* ---------- Shifts ---------- */
.shift-list { display: grid; gap: 10px; }
.shift-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; background: #fbfefd;
}
.shift-item .shift-name { font-weight: 800; color: var(--brand-green-dark); }
.shift-item .shift-times { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }
.seg-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.legend { line-height: 1.9; }

/* ---------- Today list & camera ---------- */
.today-list { line-height: 2.1; }
.shift-hint {
  margin-top: 8px; padding: 9px 13px; border-radius: 12px;
  background: var(--brand-green-soft); border: 1px solid #b7e7cb;
  color: var(--brand-green-dark); font-size: 13.5px; font-weight: 500;
}
.cam { width: 100%; max-width: 420px; border-radius: 14px; display: block; margin: 0 auto; background: #0e2418; }
.status-line { text-align: center; font-size: 13.5px; color: var(--ink-soft); margin: 10px 0; min-height: 20px; }

@media (max-width: 560px) {
  .header { padding: 12px 14px; }
  .header h1 { font-size: 17px; }
  .card { padding: 16px; }
  .punch-row { flex-direction: column; }
}

/* face scan animation */
.scan-wrap { position: relative; max-width: 420px; margin: 0 auto; border-radius: 14px; overflow: hidden; }
.scan-wrap .cam { max-width: 100%; }
.scan-ov { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; }
.scan-wrap.scanning .scan-ov, .scan-wrap.done .scan-ov { opacity: 1; }
.scan-ov .c { position: absolute; width: 38px; height: 38px; border: 4px solid #00e676; border-radius: 6px; }
.scan-ov .tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; }
.scan-ov .tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; }
.scan-ov .bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; }
.scan-ov .br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }
.scan-line { position: absolute; left: 8%; right: 8%; top: 10%; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, #00e676, transparent); box-shadow: 0 0 14px 4px rgba(0,230,118,.7); animation: scanmove 1.1s ease-in-out infinite alternate; }
@keyframes scanmove { from { top: 10%; } to { top: 88%; } }
.scan-wrap.scanning .c { animation: scanpulse 1s ease-in-out infinite alternate; }
@keyframes scanpulse { from { opacity: .5; } to { opacity: 1; } }
.scan-ok { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,166,81,.55); color: #fff; font-weight: 800; font-size: 20px; gap: 8px; }
.scan-wrap.done .scan-ok { display: flex; animation: okpop .35s ease-out; }
.scan-wrap.done .scan-line { display: none; }
.scan-wrap.done .c { border-color: #fff; }
.scan-ok svg { width: 84px; height: 84px; fill: none; stroke: #fff; stroke-width: 3; }
.scan-ok svg path { stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: okdraw .4s .1s ease-out forwards; }
@keyframes okdraw { to { stroke-dashoffset: 0; } }
@keyframes okpop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.seg-row { display: flex !important; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.seg-row > div { flex: 1 1 100%; }
.seg-row .seg-del { flex: none; }
