/* ============================================================
   Office Attendance Tracker — style.css
   ============================================================ */

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

/* ---------- Design Tokens ---------- */
:root {
  --bg-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0c0;

  /* Status colours */
  --office: #22c55e;       /* Green  – Office        */
  --office-bg: rgba(34, 197, 94, 0.18);
  --wfh: #3b82f6;          /* Blue   – Work From Home */
  --wfh-bg: rgba(59, 130, 246, 0.18);
  --leave: #ef4444;        /* Red    – Leave         */
  --leave-bg: rgba(239, 68, 68, 0.18);

  --day-hover: rgba(255, 255, 255, 0.1);
  --today-border: rgba(255, 255, 255, 0.5);
  --radius: 16px;
  --transition: 0.2s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

/* ---------- Header ---------- */
header {
  text-align: center;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 680px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

header h1 {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* User info bar (avatar + name + sign-out) */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  object-fit: cover;
}

#user-name {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signout-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}
.signout-btn:hover { background: rgba(255,255,255,0.15); color: var(--text-primary); }

/* ---------- Login Overlay ---------- */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}

.login-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 2.5rem 2rem;
  width: min(420px, 100%);
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  animation: cardIn 0.5s cubic-bezier(.22,1,.36,1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.6rem;
}

.login-card > p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.google-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  transition: transform var(--transition), box-shadow var(--transition);
}
.google-signin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
.google-signin-btn:active { transform: translateY(0); }

.login-note {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--leave);
  line-height: 1.5;
}


/* ---------- Calendar Shell ---------- */
.calendar-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 1.75rem;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* ---------- Month Navigation ---------- */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.month-nav button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-nav button:hover { background: rgba(255, 255, 255, 0.18); }

#month-label {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ---------- Day-of-Week Row ---------- */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.6rem;
}

.weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.3rem 0;
}

/* ---------- Date Grid ---------- */
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  border: 1px solid transparent;
  user-select: none;
}

.day-cell:not(.empty):hover {
  background: var(--day-hover);
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.day-cell.empty { cursor: default; }

/* Today highlight */
.day-cell.today {
  border: 1.5px solid var(--today-border);
  font-weight: 700;
}

/* Status colours on date cells */
.day-cell.status-O {
  background: var(--office-bg);
  color: var(--office);
  border-color: var(--office);
}

.day-cell.status-W {
  background: var(--wfh-bg);
  color: var(--wfh);
  border-color: var(--wfh);
}

.day-cell.status-L {
  background: var(--leave-bg);
  color: var(--leave);
  border-color: var(--leave);
}

/* Small status dot at bottom of cell */
.day-cell .status-dot {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.day-cell.status-O .status-dot { background: var(--office); }
.day-cell.status-W .status-dot { background: var(--wfh); }
.day-cell.status-L .status-dot { background: var(--leave); }

/* ---------- Legend ---------- */
.legend {
  display: flex;
  gap: 1.2rem;
  margin-top: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.office { background: var(--office); }
.legend-dot.wfh    { background: var(--wfh); }
.legend-dot.leave  { background: var(--leave); }

/* ---------- Modal Overlay ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: rgba(30, 27, 75, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(360px, 90vw);
  text-align: center;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal h2 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.modal #modal-date {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.status-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.status-btn.office-btn {
  background: var(--office-bg);
  border-color: var(--office);
  color: var(--office);
}
.status-btn.office-btn:hover { background: var(--office); color: #fff; }

.status-btn.wfh-btn {
  background: var(--wfh-bg);
  border-color: var(--wfh);
  color: var(--wfh);
}
.status-btn.wfh-btn:hover { background: var(--wfh); color: #fff; }

.status-btn.leave-btn {
  background: var(--leave-bg);
  border-color: var(--leave);
  color: var(--leave);
}
.status-btn.leave-btn:hover { background: var(--leave); color: #fff; }

.clear-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 0.4rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.clear-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(30, 27, 75, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.7rem 1.4rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transition: transform 0.35s ease, opacity 0.35s ease;
  z-index: 200;
  opacity: 0;
}

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

/* ---------- Loading Spinner ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.2);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}

/* ---------- Stats Bar ---------- */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stat-pill {
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform var(--transition);
}
.stat-pill:hover { transform: translateY(-2px); }

.stat-pill.office { border-color: var(--office); color: var(--office); background: var(--office-bg); }
.stat-pill.wfh    { border-color: var(--wfh);    color: var(--wfh);    background: var(--wfh-bg);    }
.stat-pill.leave  { border-color: var(--leave);  color: var(--leave);  background: var(--leave-bg);  }

/* ---------- Filter Bar ---------- */
.filter-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.35rem 0.9rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-chip:hover { background: rgba(255, 255, 255, 0.12); color: var(--text-primary); }
.filter-chip.active {
  background: var(--text-primary);
  color: #1e1b4b;
  border-color: var(--text-primary);
  font-weight: 700;
}

/* Dimming logic for filtering */
.day-cell.dimmed {
  opacity: 0.15;
  filter: grayscale(0.8);
  pointer-events: none;
}

/* ---------- View Toggle ---------- */
.view-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ---------- List View ---------- */
.list-view {
  margin-top: 0.5rem;
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.list-view table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.list-view th {
  text-align: left;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.list-view td {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}

.list-view tr td:first-child {
  border-left: 1px solid var(--glass-border);
  border-radius: 12px 0 0 12px;
  font-weight: 600;
}

.list-view tr td:last-child {
  border-right: 1px solid var(--glass-border);
  border-radius: 0 12px 12px 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-badge.O { background: var(--office-bg); color: var(--office); border: 1px solid var(--office); }
.status-badge.W { background: var(--wfh-bg);    color: var(--wfh);    border: 1px solid var(--wfh);    }
.status-badge.L { background: var(--leave-bg);  color: var(--leave);  border: 1px solid var(--leave);  }

/* ---------- Cards View (Designer) ---------- */
.cards-view {
  margin-top: 1rem;
  animation: fadeIn 0.4s ease both;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1.25rem;
  padding: 0.5rem 0;
}

.status-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem 1rem;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}

.status-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: rgba(255, 255, 255, 0.08);
}

.status-card .status-icon {
  font-size: 2.2rem;
  margin-bottom: 0.2rem;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.2));
}

.status-card .card-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.status-card .card-status-text {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* Status-specific glows */
.status-card.O { border-color: var(--office); box-shadow: 0 10px 30px -10px rgba(34, 197, 94, 0.3); }
.status-card.W { border-color: var(--wfh);    box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.3); }
.status-card.L { border-color: var(--leave);  box-shadow: 0 10px 30px -10px rgba(239, 68, 68, 0.3); }

.status-card.O:hover { box-shadow: 0 15px 40px -5px rgba(34, 197, 94, 0.5); }
.status-card.W:hover { box-shadow: 0 15px 40px -5px rgba(59, 130, 246, 0.5); }
.status-card.L:hover { box-shadow: 0 15px 40px -5px rgba(239, 68, 68, 0.5); }

.list-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9rem;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .calendar-card { padding: 1rem; }
  .days-grid { gap: 4px; }
  .day-cell { font-size: 0.78rem; border-radius: 7px; }
  .legend { gap: 0.8rem; }
}
