/* ============================================================
   BWM Attendance Portal — Bria Quartz Brand Style
   Font: Lato (briaquartz.co primary font)
   Colors: Black #000, White #FFF, Teal accent #1abc9c
   Buttons: Pill-shaped (border-radius: 50px) matching brand
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;500;600;700;900&display=swap');

:root {
  --primary:       #000000;
  --primary-hover: #303030;
  --primary-light: #424242;
  --success:       #1abc9c;
  --success-dark:  #17a589;
  --success-light: #e8faf6;
  --danger:        #c0392b;
  --danger-hover:  #a93226;
  --danger-light:  #fdecea;
  --warning:       #e67e22;
  --warning-light: #fef3e2;
  --text:          #000000;
  --text-body:     #505C6B;
  --text-muted:    #838383;
  --text-small:    #5e5e5e;
  --border:        #D0D0D0;
  --border-dark:   #323232;
  --bg:            #FFFFFF;
  --bg-light:      #F8F8F8;
  --bg-input:      #FFFFFF;
  --radius-btn:    50px;
  --radius-card:   4px;
  --shadow:        0 2px 16px rgba(0,0,0,0.08);
  --shadow-hover:  0 4px 24px rgba(0,0,0,0.14);
  --font:          'Lato', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-weight: 400;
  color: var(--text-body);
  background: var(--bg-light);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── LOGIN PAGE — Mobile-first, no centering gap ────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Header: black bar with logo + subtitle directly below */
.login-header {
  background: var(--primary);
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.login-header img {
  height: 34px;
  width: auto;
}

.header-tagline {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
}

/* Form starts right below header — top-aligned, no centering */
.login-body {
  flex: 1;
  padding: 0;
}

.login-card {
  width: 100%;
  max-width: 100%;
  padding: 1.75rem 1.5rem 2rem;
}

/* Tablet and up — constrain width and center */
@media (min-width: 480px) {
  .login-body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: var(--bg-light);
  }
  .login-card {
    max-width: 420px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 2rem;
  }
}

.login-help {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

/* ── FORM ───────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1.5rem;   /* more breathing room on mobile */
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 1rem 1.1rem;       /* taller for finger tap */
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  font-family: var(--font);
  font-size: 18px;             /* larger text on mobile */
  font-weight: 400;
  color: var(--primary);
  background: var(--bg-input);
  transition: border-color 0.2s;
  outline: none;
  -webkit-appearance: none;   /* remove iOS default styling */
  appearance: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
  outline: none;
}

/* Company select dropdown — same look as text inputs */
.form-group select.form-input {
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-input);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23505C6B' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
}

.form-group input::placeholder {
  color: #C0C0C0;
  font-weight: 300;
}

/* ── BUTTONS ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: 2px solid transparent;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s ease;
  min-height: 58px;         /* tall touch target for mobile */
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-hover);
}

.btn-full { width: 100%; }

.btn-ghost {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-btn);
  transition: color 0.15s;
}

.btn-ghost:hover { color: #fff; }

/* Clock buttons — large, pill-shaped, brand style */
.btn-clock-in {
  width: 100%;
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  padding: 1.1rem 2rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: all 0.22s;
  min-height: 60px;
  margin-bottom: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-clock-in:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-clock-in:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-clock-out {
  width: 100%;
  background: transparent;
  color: var(--danger);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  padding: 1.1rem 2rem;
  border: 2px solid var(--danger);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: all 0.22s;
  min-height: 60px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-clock-out:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-clock-out:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ── LOGIN ERROR BOX — fixed at top, above keyboard ─────────── */

.login-error-box {
  display: none;
  align-items: flex-start;
  gap: 0.65rem;
  background: #fff0f0;
  border: 2px solid var(--danger);
  border-radius: var(--radius-card);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 15px;
  font-weight: 600;
  color: var(--danger);
  line-height: 1.4;
}

.login-error-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Shake animation — makes error impossible to miss */
@keyframes shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-8px); }
  30%  { transform: translateX(8px); }
  45%  { transform: translateX(-6px); }
  60%  { transform: translateX(6px); }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.login-error-box.shake {
  animation: shake 0.45s ease-in-out;
}

/* ── ALERTS ─────────────────────────────────────────────────── */

.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-card);
  font-size: 15px;
  font-weight: 400;
  margin: 1rem 0;
  border-left: 3px solid transparent;
}

.alert-error {
  background: var(--danger-light);
  color: var(--danger);
  border-left-color: var(--danger);
}

.alert-success {
  background: var(--success-light);
  color: var(--success-dark);
  border-left-color: var(--success);
}

/* ── APP LAYOUT ─────────────────────────────────────────────── */

.app-page { padding-bottom: 72px; background: var(--bg-light); }

.app-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  max-width: 600px;
  margin: 0 auto;
}

.header-logo img {
  height: 28px;
  width: auto;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
}

.app-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

/* ── EMPLOYEE CARD ──────────────────────────────────────────── */

.info-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.employee-avatar {
  width: 52px;
  height: 52px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.employee-info h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}

.employee-info .emp-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.employee-info .emp-no {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── STATUS CARD ────────────────────────────────────────────── */

.status-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  text-align: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.status-in  { background: var(--success-light); color: var(--success-dark); }
.status-out { background: var(--bg-light); color: var(--text-muted); border: 1px solid var(--border); }

.status-detail {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.status-detail strong { color: var(--primary); }

/* ── GPS BANNER ─────────────────────────────────────────────── */

.gps-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-card);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.gps-waiting { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.gps-ok      { background: var(--success-light); color: var(--success-dark); border-color: #a7f3d0; }
.gps-error   { background: var(--warning-light); color: var(--warning); border-color: #fcd5a3; }

/* ── ACTION SECTION ─────────────────────────────────────────── */

.action-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

/* ── DATE/TIME ──────────────────────────────────────────────── */

.datetime-section {
  text-align: center;
  padding: 0.75rem 0;
}

.current-time {
  font-size: 42px;
  font-weight: 300;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

.current-date {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

/* ── BOTTOM NAV ─────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.65rem 0.5rem;
  text-decoration: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  gap: 0.25rem;
  transition: color 0.15s;
}

.nav-item .nav-icon { font-size: 1.2rem; }
.nav-item.active { color: var(--primary); }

/* ── FILTER SECTION ─────────────────────────────────────────── */

.filter-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 0.85rem;
  overflow: hidden;
}

.filter-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.filter-row:last-child { border-bottom: none; }

.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  min-width: 42px;
}

/* Scrollable pill row */
.filter-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}

.filter-pills::-webkit-scrollbar { display: none; }

.pill {
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.pill:hover   { border-color: var(--primary); color: var(--primary); }
.pill.active  { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Status + Late selects in one row */
.filter-select-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}

.filter-select {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  background: var(--bg);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23000' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 1.8rem;
}

.filter-select:focus {
  border-color: var(--primary);
  outline: none;
}

/* Custom date range */
.filter-row-dates { padding: 0.6rem 1rem; }

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.date-sep { font-size: 16px; color: var(--text-muted); }

.date-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.date-input-group label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.date-input-group input[type="date"] {
  padding: 0.45rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  font-family: var(--font);
  font-size: 13px;
  color: var(--primary);
  background: var(--bg);
  width: 100%;
}

/* ── SUMMARY STATS BAR ──────────────────────────────────────── */

.stats-bar {
  display: flex;
  align-items: center;
  background: var(--primary);
  border-radius: var(--radius-card);
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  gap: 0;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.15);
}

/* ── CLEAR FILTER BUTTON ────────────────────────────────────── */

.btn-clear-filter {
  margin-top: 1rem;
  padding: 0.5rem 1.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.18s;
}

.btn-clear-filter:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── HISTORY PAGE ───────────────────────────────────────────── */

.page-title {
  padding: 0.5rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.page-title h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.page-title p { font-size: 14px; color: var(--text-muted); margin-top: 3px; }

.loading-state, .empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
  font-size: 15px;
}

.history-list { display: flex; flex-direction: column; gap: 0.85rem; }

.history-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.history-card:hover { box-shadow: var(--shadow-hover); }
.history-card-late  { border-left: 3px solid var(--warning); }

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
}

.history-date {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  flex: 1;
}

.history-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-times {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.history-time-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 0.6rem 0.5rem;
}

.history-time-item:not(:last-child) {
  border-right: 1px solid var(--border);
}

.time-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.time-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

/* ── BADGES ─────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-btn);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-in   { background: var(--success-light); color: var(--success-dark); }
.badge-out  { background: var(--bg-light); color: var(--text-muted); border: 1px solid var(--border); }
.badge-late { background: var(--warning-light); color: var(--warning); }

/* ── SPINNER ────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-large {
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── UTILITY ────────────────────────────────────────────────── */

.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 13px; }
.text-error  { color: var(--danger); }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */

@media (min-width: 480px) {
  .btn-clock-in, .btn-clock-out { font-size: 20px; min-height: 68px; }
  .current-time { font-size: 52px; }
  .login-title  { font-size: 32px; }
}
