/* ============================================================
   ZAS Staff Report System — Main CSS
   Theme: Cream / Gold / White — Mobile First
   ============================================================ */

:root {
  --gold:         #C9A84C;
  --gold-light:   #E8C97A;
  --gold-dark:    #8B6914;
  --gold-grad:    linear-gradient(135deg, #C9A84C, #E8C97A);
  --cream:        #FAF6EE;
  --cream2:       #F3ECD8;
  --cream3:       #E8DFC8;
  --white:        #FFFFFF;
  --dark:         #18180F;
  --dark2:        #2A2A1A;
  --gray:         #7A7A65;
  --gray-light:   #E4DDD0;
  --green:        #3A7D52;
  --green-bg:     #D0EDDA;
  --red:          #B84444;
  --red-bg:       #FDE8E8;
  --amber:        #C97A20;
  --amber-bg:     #FFF0D0;
  --sidebar-w:    230px;
  --topbar-h:     54px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --shadow-md:    0 4px 24px rgba(0,0,0,.12);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.18);
  --r:            12px;
  --r-sm:         8px;
}

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

html { font-size: 16px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--cream2);
  color: var(--dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── APP SHELL ─────────────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 300;
  border-bottom: 2px solid var(--gold-dark);
  box-shadow: var(--shadow-md);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.topbar-logo { font-size: 17px; font-weight: 900; color: var(--gold); letter-spacing: 1px; }
.topbar-logo span { color: #aaa; font-weight: 500; font-size: 14px; }

.sidebar-toggle {
  background: none; border: none; color: #aaa;
  font-size: 20px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px; transition: color .15s;
  display: none;
}
.sidebar-toggle:hover { color: var(--gold); }

.user-avatar {
  width: 34px; height: 34px;
  background: var(--gold-grad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--dark);
  flex-shrink: 0;
}
.user-info { display: none; }
.user-name  { font-size: 13px; font-weight: 700; color: #ddd; }
.user-role  { font-size: 11px; color: #777; }

.logout-btn {
  font-size: 20px; text-decoration: none;
  padding: 4px 6px; border-radius: 6px;
  transition: opacity .15s; opacity: .7;
}
.logout-btn:hover { opacity: 1; }

.alarm-bell {
  font-size: 20px; cursor: pointer; position: relative;
  padding: 4px; border-radius: 6px;
}
.alarm-count {
  position: absolute; top: -2px; right: -2px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800;
  border-radius: 50%; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--dark);
  overflow-y: auto;
  z-index: 200;
  border-right: 1px solid #222;
  transition: transform .25s ease;
}
.sidebar-inner { padding: 12px 0 24px; }

.nav-section {
  font-size: 10px; font-weight: 700;
  color: #444; letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 18px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  font-size: 13px; font-weight: 600;
  color: #888; text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-item span { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { color: #ccc; background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--gold); background: rgba(201,168,76,.09); border-left-color: var(--gold); }
.nav-item.nav-logout { color: #666; margin-top: 4px; }
.nav-item.nav-logout:hover { color: var(--red); }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800; border-radius: 20px;
  padding: 2px 7px; min-width: 20px; text-align: center;
}

/* ── MAIN CONTENT ─────────────────────────────────────────────── */
.main-content {
  margin-top: var(--topbar-h);
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left .25s;
}

/* ── PAGE HEADER ──────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title   { font-size: 22px; font-weight: 800; color: var(--dark); }
.page-subtitle { font-size: 13px; color: var(--gray); margin-top: 3px; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 700;
  cursor: pointer; border: none;
  text-decoration: none; transition: opacity .15s;
  font-family: inherit;
}
.btn:hover { opacity: .85; }
.btn-gold    { background: var(--gold-grad); color: var(--dark); }
.btn-dark    { background: var(--dark); color: var(--gold); }
.btn-outline { background: var(--white); color: var(--dark); border: 1.5px solid var(--gray-light); }
.btn-red     { background: linear-gradient(135deg, var(--red), #d46060); color: #fff; }
.btn-green   { background: linear-gradient(135deg, var(--green), #5aad72); color: #fff; }
.btn-sm      { padding: 7px 14px; font-size: 12px; }
.btn-block   { width: 100%; justify-content: center; }
.btn-lg      { padding: 14px 24px; font-size: 15px; font-weight: 800; }

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--white); border-radius: var(--r);
  padding: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-light);
}
.stat-card-top {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.stat-label { font-size: 11px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: .5px; }
.stat-icon  { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.si-gold    { background: rgba(201,168,76,.15); }
.si-green   { background: rgba(58,125,82,.12); }
.si-red     { background: rgba(184,68,68,.12); }
.si-blue    { background: rgba(58,100,160,.12); }
.stat-num   { font-size: 32px; font-weight: 900; color: var(--dark); line-height: 1; }
.stat-note  { font-size: 11px; color: var(--gray); margin-top: 4px; }
.stat-note.up   { color: var(--green); }
.stat-note.down { color: var(--red); }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--r);
  box-shadow: var(--shadow); border: 1px solid var(--gray-light);
  margin-bottom: 20px; overflow: hidden;
}
.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--gray-light);
}
.card-title { font-size: 14px; font-weight: 800; color: var(--dark); }
.card-link  { font-size: 12px; color: var(--gold-dark); font-weight: 700; cursor: pointer; text-decoration: none; }
.card-body  { padding: 20px; }

/* ── FORM CONTROLS ──────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--gray); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--r-sm); font-size: 13px;
  font-family: inherit; color: var(--dark);
  background: var(--cream); transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--gold); background: var(--white); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint  { font-size: 11px; color: var(--gray); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; }

/* ── HOUR SLOTS (Staff) ──────────────────────────────────────── */
.slot-list { display: flex; flex-direction: column; gap: 10px; }
.hour-slot {
  border-radius: var(--r-sm); border: 1.5px solid var(--gray-light);
  background: var(--white); overflow: hidden;
  transition: border-color .2s;
}
.hour-slot.slot-active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,.15); }
.hour-slot.slot-done   { border-color: var(--green-bg); }
.hour-slot.slot-miss   { border-color: var(--red-bg); }

.slot-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--cream);
}
.slot-time   { font-size: 13px; font-weight: 800; color: var(--dark); flex: 1; }
.slot-status { font-size: 12px; font-weight: 700; }
.ss-done     { color: var(--green); }
.ss-active   { color: var(--amber); }
.ss-lock     { color: #bbb; }
.ss-miss     { color: var(--red); }

.slot-body  { padding: 12px 16px 14px; }
.slot-task-tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: var(--gold-dark); background: rgba(201,168,76,.12);
  border-radius: 4px; padding: 3px 9px; margin-bottom: 8px;
}
.slot-submitted-text { font-size: 13px; color: var(--dark); line-height: 1.6; }
.slot-locked-msg { padding: 10px 16px; font-size: 12px; color: #bbb; }

/* ── STAFF LIVE TABLE ───────────────────────────────────────── */
.staff-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-light);
  transition: background .12s;
}
.staff-row:last-child  { border-bottom: none; }
.staff-row:hover       { background: var(--cream); }
.staff-row.row-alert   { background: rgba(184,68,68,.03); }

.sr-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
  color: var(--dark);
}
.sr-info   { flex: 1; min-width: 0; }
.sr-name   { font-size: 13px; font-weight: 700; color: var(--dark); }
.sr-dept   { font-size: 11px; color: var(--gray); margin-top: 1px; }
.sr-pills  { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

.pill {
  font-size: 10px; font-weight: 700;
  border-radius: 20px; padding: 2px 9px;
}
.pill-done { background: var(--green-bg); color: var(--green); }
.pill-miss { background: var(--red-bg);   color: var(--red); }
.pill-pend { background: var(--amber-bg); color: var(--amber); }
.pill-lock { background: var(--gray-light); color: var(--gray); }

.sr-online {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-on   { background: var(--green); box-shadow: 0 0 0 3px rgba(58,125,82,.2); }
.dot-off  { background: #bbb; }
.dot-warn { background: var(--red); animation: blink-dot 1.2s infinite; }
@keyframes blink-dot { 0%,100%{opacity:1} 50%{opacity:.3} }

.sr-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── REPORT FEED ────────────────────────────────────────────── */
.report-row {
  display: flex; gap: 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--gray-light);
  align-items: flex-start;
}
.report-row:last-child { border-bottom: none; }
.rr-time {
  width: 88px; flex-shrink: 0;
  font-size: 12px; font-weight: 800;
  color: var(--gold-dark); padding-top: 2px;
  line-height: 1.4;
}
.rr-body    { flex: 1; min-width: 0; }
.rr-staff   { font-size: 11px; font-weight: 700; color: var(--gray); margin-bottom: 4px; }
.rr-task    {
  font-size: 12px; background: rgba(201,168,76,.10);
  border-left: 3px solid var(--gold);
  padding: 5px 10px; border-radius: 0 6px 6px 0;
  color: var(--gold-dark); font-weight: 600; margin-bottom: 6px;
}
.rr-text    {
  font-size: 12px; color: var(--dark);
  background: var(--cream); border-radius: 6px;
  padding: 8px 11px; border: 1px solid var(--gray-light);
  line-height: 1.5;
}
.rr-missing {
  font-size: 12px; color: var(--red); font-weight: 700;
  background: var(--red-bg); border-radius: 6px;
  padding: 8px 11px;
}
.rr-badge { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 20px; padding: 2px 9px; margin-top: 6px; }
.rb-ontime  { background: var(--green-bg); color: var(--green); }
.rb-late    { background: var(--amber-bg); color: var(--amber); }
.rb-missing { background: var(--red-bg);   color: var(--red); }

/* ── FILTER BAR ─────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--gray-light); flex-wrap: wrap; }
.filter-chip {
  padding: 6px 14px; border-radius: 20px;
  border: 1.5px solid var(--gray-light);
  background: var(--cream); font-size: 12px;
  font-weight: 600; color: var(--gray);
  cursor: pointer; transition: all .15s; text-decoration: none;
}
.filter-chip:hover, .filter-chip.active { background: var(--gold-grad); color: var(--dark); border-color: var(--gold); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 500;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--r);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-head {
  background: var(--dark); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title  { font-size: 14px; font-weight: 800; color: var(--gold); }
.modal-close  { background: none; border: none; color: #888; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #fff; }
.modal-body   { padding: 20px; }
.modal-foot   { padding: 14px 20px; border-top: 1px solid var(--gray-light); display: flex; gap: 8px; justify-content: flex-end; }

/* ── ALERTS / BADGES ────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-error   { background: var(--red-bg);   color: var(--red); }
.alert-warn    { background: var(--amber-bg); color: var(--amber); }
.alert-info    { background: rgba(201,168,76,.12); color: var(--gold-dark); border: 1px solid rgba(201,168,76,.3); }
.badge-role {
  display: inline-block; font-size: 10px; font-weight: 700;
  border-radius: 4px; padding: 2px 8px;
}
.br-admin   { background: rgba(201,168,76,.2); color: var(--gold-dark); }
.br-manager { background: rgba(58,100,160,.15); color: #3A6490; }
.br-staff   { background: var(--green-bg); color: var(--green); }

/* ── ALARM OVERLAY ──────────────────────────────────────────── */
.alarm-overlay {
  position: fixed; inset: 0; background: rgba(100,0,0,.75);
  z-index: 900; display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: alarm-flash 1s infinite;
}
@keyframes alarm-flash { 0%,100%{background:rgba(100,0,0,.75)} 50%{background:rgba(150,0,0,.85)} }
.alarm-modal {
  background: var(--white); border-radius: var(--r);
  padding: 32px 28px; text-align: center;
  max-width: 380px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.alarm-modal-icon  { font-size: 52px; margin-bottom: 12px; animation: shake-icon .4s infinite; }
@keyframes shake-icon { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-20deg)} 75%{transform:rotate(20deg)} }
.alarm-modal-title { font-size: 18px; font-weight: 900; color: var(--red); margin-bottom: 10px; }
.alarm-modal-msg   { font-size: 14px; color: var(--dark); margin-bottom: 20px; line-height: 1.5; }
.alarm-ack-btn {
  background: var(--gold-grad); color: var(--dark); border: none;
  border-radius: var(--r-sm); padding: 13px 30px;
  font-size: 15px; font-weight: 800; cursor: pointer;
  width: 100%; font-family: inherit;
}

/* ── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--dark2); color: #fff;
  border-left: 4px solid var(--gold);
  padding: 14px 20px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 800;
  display: none; max-width: 340px;
  animation: toast-in .3s ease;
}
@keyframes toast-in { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }
.toast.show { display: block; }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
  padding: 20px;
}
.login-card {
  background: var(--white); border-radius: var(--r);
  padding: 36px 32px; width: 100%;
  max-width: 380px; box-shadow: var(--shadow-lg);
}
.login-logo  { text-align: center; margin-bottom: 24px; }
.login-logo-mark { font-size: 36px; font-weight: 900; color: var(--gold); letter-spacing: 2px; }
.login-logo-sub  { font-size: 13px; color: var(--gray); margin-top: 4px; }
.login-title { font-size: 19px; font-weight: 800; margin-bottom: 20px; text-align: center; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-wrap { margin-bottom: 14px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--gray); margin-bottom: 6px; }
.progress-track { background: var(--gray-light); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 20px; background: var(--gold-grad); transition: width .4s ease; }

/* ── TABLE ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { background: var(--dark); color: var(--gold); padding: 11px 14px; text-align: left; font-size: 11px; letter-spacing: .5px; white-space: nowrap; }
table.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--gray-light); color: var(--gray); vertical-align: middle; }
table.data-table tr:last-child td { border: none; }
table.data-table tr:hover td { background: var(--cream); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-toggle { display: block; }
  .main-content   { margin-left: 0; padding: 16px; }
  .user-info      { display: block; }
  .page-header    { flex-direction: column; align-items: flex-start; }
  .sr-actions     { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .main-content { padding: 12px; }
  .btn-lg { font-size: 14px; padding: 12px 18px; }
  .page-title { font-size: 18px; }
  table.data-table th, table.data-table td { padding: 9px 10px; }
}
