/* KFWC Attendance: stylesheet
   Brand: navy #152c6e, gold #D9B700, off-white background, Inter typography. */

:root {
  --navy: #152c6e;
  --navy-dark: #0d1d4a;
  --navy-light: #1e3a8a;
  --gold: #d9b700;
  --gold-dark: #c7a700;
  --gold-light: #ffe033;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning-bg: #fef3c7;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius: 10px;
  --radius-sm: 6px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input, select {
  font-family: inherit;
  font-size: inherit;
}

.hidden {
  display: none !important;
}

/* ---------- Layout ---------- */

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.screen-loading,
.screen-login {
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

/* ---------- Offline banner ---------- */

.offline-banner {
  background: var(--warning-bg);
  color: #92400e;
  text-align: center;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid #fcd34d;
}

/* ---------- Logo and login ---------- */

.logo-large {
  width: 140px;
  height: 140px;
  border-radius: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.logo-small {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.app-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.app-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 320px;
}

.loading-text {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.05s, opacity 0.15s;
  min-height: 48px;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary {
  background: var(--navy);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-dark);
}

.btn-gold {
  background: var(--gold);
  color: var(--navy);
}

.btn-gold:hover:not(:disabled) {
  background: var(--gold-dark);
}

.btn-outline {
  background: var(--surface);
  color: var(--navy);
  border: 1.5px solid var(--navy);
}

.btn-google {
  background: white;
  color: #1f1f1f;
  border: 1px solid var(--border);
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow);
}

.btn-google img {
  width: 20px;
  height: 20px;
}

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 18px 24px;
  font-size: 17px;
  min-height: 60px;
}

/* ---------- Header ---------- */

.app-header {
  background: var(--navy);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
}

.header-back {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.header-back:hover {
  background: rgba(255, 255, 255, 0.2);
}

.header-menu-btn {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Content area ---------- */

.content {
  padding: 20px 16px 80px;
  flex: 1;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  margin-top: 24px;
}

.section-title:first-child {
  margin-top: 0;
}

/* ---------- Home dashboard ---------- */

.welcome-card {
  background: var(--navy);
  color: white;
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.welcome-greeting {
  font-size: 14px;
  opacity: 0.85;
}

.welcome-name {
  font-size: 22px;
  font-weight: 700;
  margin-top: 2px;
}

.welcome-date {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 6px;
}

.action-grid {
  display: grid;
  gap: 12px;
}

.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.05s, border-color 0.15s;
}

.action-card:hover {
  border-color: var(--navy);
}

.action-card:active {
  transform: scale(0.99);
}

.action-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.action-card-icon.gold {
  background: rgba(217, 183, 0, 0.15);
  color: var(--gold-dark);
}

.action-card-icon.navy {
  background: rgba(21, 44, 110, 0.1);
  color: var(--navy);
}

.action-card-content {
  flex: 1;
}

.action-card-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.action-card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.action-card-chevron {
  color: var(--text-muted);
  font-size: 20px;
}

/* ---------- Forms ---------- */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 16px;
  min-height: 48px;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(21, 44, 110, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- Service selector ---------- */

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.service-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.service-tab {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.service-tab.active {
  background: var(--navy);
  color: white;
}

/* ---------- Person rows ---------- */

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

.person-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.person-row.status-present {
  border-left: 4px solid var(--success);
}

.person-row.status-absent {
  border-left: 4px solid var(--danger);
}

.person-info {
  flex: 1;
  min-width: 0;
}

.person-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.person-actions {
  display: flex;
  gap: 6px;
}

.mark-btn {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  min-height: 38px;
  min-width: 56px;
}

.mark-btn.present.active {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}

.mark-btn.absent.active {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

/* ---------- Stats footer ---------- */

.stats-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-around;
  font-size: 13px;
  z-index: 5;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.stat-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 90%;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ---------- Errors ---------- */

.error-card {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

/* ---------- Tablet and up ---------- */

@media (min-width: 768px) {
  .content {
    padding: 24px;
  }
}
