/* Staff App - Mobile App Styles */

:root {
  /* Brand Colors */
  --ink: #101014;
  --ink-light: #6b6b70;
  --paper: #f9f5ef;
  --mist: #efe7dd;
  --sea: #3b7e8c;
  --sea-light: rgba(59, 126, 140, 0.12);
  --sea-medium: rgba(59, 126, 140, 0.2);
  --sun: #f4b860;
  --leaf: #3f6b5b;
  --accent: #d85f4c;
  --accent-light: rgba(216, 95, 76, 0.12);
  --success: #4a9d6e;
  --success-light: rgba(74, 157, 110, 0.12);
  --white: #ffffff;

  /* App Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* App Sizing */
  --touch-target: 48px;
  --nav-height: 64px;
  --header-height: 56px;
  --fab-size: 56px;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-full: 999px;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ================================
   App Header
   ================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  padding: var(--space-md);
  padding-top: calc(var(--space-md) + var(--safe-top));
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-bottom: 1px solid var(--mist);
}

.app-header-back {
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  margin: calc(var(--space-sm) * -1);
}

.app-header-back:active {
  background: var(--mist);
}

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

.app-header-action {
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sea);
  border-radius: var(--border-radius);
  margin: calc(var(--space-sm) * -1);
}

.app-header-action:active {
  background: var(--sea-light);
}

/* ================================
   Bottom Navigation
   ================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--white);
  border-top: 1px solid var(--mist);
  padding-bottom: var(--safe-bottom);
  display: flex;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-xs);
  min-height: var(--nav-height);
  color: var(--ink-light);
  position: relative;
  transition: color 0.2s;
}

.bottom-nav-item.active {
  color: var(--sea);
}

.bottom-nav-item:active {
  background: var(--mist);
}

.bottom-nav-icon {
  width: 24px;
  height: 24px;
  position: relative;
}

.bottom-nav-icon svg {
  width: 100%;
  height: 100%;
}

.bottom-nav-label {
  font-size: 11px;
  font-weight: 500;
}

.bottom-nav-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: var(--white);
  font-size: 10px;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================================
   Page Content
   ================================ */
.page-content {
  padding: var(--space-md);
}

.page-content-flush {
  padding: 0;
}

/* ================================
   Cards
   ================================ */
.card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card + .card {
  margin-top: var(--space-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-action {
  color: var(--sea);
  font-size: 14px;
  font-weight: 500;
}

/* ================================
   Welcome Section (Home)
   ================================ */
.welcome-section {
  padding: var(--space-lg) var(--space-md) var(--space-md);
}

.welcome-greeting {
  font-size: 14px;
  color: var(--ink-light);
  margin-bottom: var(--space-xs);
}

.welcome-name {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.today-card {
  background: linear-gradient(135deg, var(--sea) 0%, #2d6270 100%);
  color: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
}

.today-label {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: var(--space-xs);
}

.today-count {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.today-subtitle {
  font-size: 16px;
  opacity: 0.9;
}

/* ================================
   Stats Row
   ================================ */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.stat-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-md);
  text-align: center;
}

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

.stat-label {
  font-size: 13px;
  color: var(--ink-light);
  margin-top: var(--space-xs);
}

/* ================================
   Next Visit Card
   ================================ */
.next-visit-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-md);
  margin-top: var(--space-md);
}

.next-visit-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.next-visit-badge {
  background: var(--sun);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius-full);
}

.next-visit-time {
  font-size: 13px;
  color: var(--ink-light);
}

.next-visit-client {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.next-visit-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ================================
   Buttons
   ================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: var(--touch-target);
  padding: 0 var(--space-lg);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--border-radius-full);
  transition: all 0.2s;
}

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

.btn-primary:active {
  background: #2d6270;
}

.btn-secondary {
  background: var(--sea-light);
  color: var(--sea);
}

.btn-secondary:active {
  background: var(--sea-medium);
}

.btn-danger {
  background: var(--accent-light);
  color: var(--accent);
}

.btn-danger:active {
  background: rgba(216, 95, 76, 0.2);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: var(--touch-target);
  padding: 0;
}

/* ================================
   Visit List
   ================================ */
.visit-list {
  padding: var(--space-md);
}

.visit-date-group {
  margin-bottom: var(--space-lg);
}

.visit-date-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 10;
}

.visit-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.visit-card:active {
  background: var(--mist);
}

.visit-time {
  text-align: center;
  min-width: 54px;
}

.visit-time-hour {
  font-size: 18px;
  font-weight: 700;
  color: var(--sea);
}

.visit-time-period {
  font-size: 12px;
  color: var(--ink-light);
}

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

.visit-client {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visit-type {
  font-size: 13px;
  color: var(--ink-light);
}

.visit-video-btn {
  width: 40px;
  height: 40px;
  background: var(--sea-light);
  color: var(--sea);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.visit-video-btn:active {
  background: var(--sea-medium);
}

.visit-arrow {
  color: var(--ink-light);
  flex-shrink: 0;
}

/* ================================
   Visit Detail
   ================================ */
.visit-detail {
  padding: var(--space-lg) var(--space-md);
}

.visit-detail-client {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.visit-detail-datetime {
  font-size: 16px;
  color: var(--ink-light);
  margin-bottom: var(--space-lg);
}

.visit-detail-section {
  margin-top: var(--space-lg);
}

.visit-detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

.visit-detail-notes {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-md);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}

.visit-detail-notes-empty {
  color: var(--ink-light);
  font-style: italic;
}

.visit-detail-actions {
  margin-top: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ================================
   Monthly Calendar
   ================================ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--white);
}

.calendar-month {
  font-size: 18px;
  font-weight: 600;
}

.calendar-nav {
  display: flex;
  gap: var(--space-sm);
}

.calendar-nav-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  color: var(--ink);
}

.calendar-nav-btn:active {
  background: var(--mist);
}

.calendar-grid {
  background: var(--white);
  padding: 0 var(--space-md) var(--space-md);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: var(--space-sm);
}

.calendar-weekday {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  padding: var(--space-sm) 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--border-radius);
  position: relative;
}

.calendar-day:active {
  background: var(--mist);
}

.calendar-day.other-month {
  color: var(--ink-light);
  opacity: 0.4;
}

.calendar-day.today {
  background: var(--sea);
  color: var(--white);
}

.calendar-day.selected {
  background: var(--sea-light);
  color: var(--sea);
}

.calendar-day.selected.today {
  background: var(--sea);
  color: var(--white);
}

.calendar-day.has-slots::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--success);
  border-radius: 50%;
}

.calendar-day.today.has-slots::after {
  background: var(--white);
}

/* ================================
   Day Slots
   ================================ */
.day-slots-section {
  padding: var(--space-md);
}

.day-slots-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.day-slots-title {
  font-size: 16px;
  font-weight: 600;
}

.day-slots-subtitle {
  font-size: 13px;
  color: var(--ink-light);
}

.day-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.day-slot {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  border: 2px solid transparent;
}

.day-slot.available {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.day-slot.booked {
  background: var(--sea-light);
  color: var(--sea);
  border-color: var(--sea);
}

.day-slot:active {
  opacity: 0.8;
}

.day-slots-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ink-light);
}

/* ================================
   Floating Action Button
   ================================ */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-md));
  right: var(--space-md);
  width: var(--fab-size);
  height: var(--fab-size);
  background: var(--sea);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 126, 140, 0.4);
  z-index: 100;
}

.fab:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(59, 126, 140, 0.4);
}

.fab svg {
  width: 28px;
  height: 28px;
}

/* ================================
   Bottom Sheet
   ================================ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  padding: var(--space-md);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.sheet-overlay.active .sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--mist);
  border-radius: 2px;
  margin: 0 auto var(--space-md);
}

.sheet-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  text-align: center;
}

.sheet-content {
  margin-bottom: var(--space-lg);
}

/* ================================
   Form Elements
   ================================ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select {
  width: 100%;
  height: var(--touch-target);
  padding: 0 var(--space-md);
  font-size: 16px;
  border: 1px solid var(--mist);
  border-radius: var(--border-radius);
  background: var(--white);
  color: var(--ink);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--sea);
}

/* ================================
   Notifications
   ================================ */
.notification-list {
  padding: var(--space-md);
}

.notification-item {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-md);
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.notification-item.unread {
  background: var(--sea-light);
}

.notification-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon.scheduled {
  background: var(--success-light);
  color: var(--success);
}

.notification-icon.canceled {
  background: var(--accent-light);
  color: var(--accent);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.notification-message {
  font-size: 14px;
  color: var(--ink-light);
  margin-bottom: var(--space-xs);
}

.notification-time {
  font-size: 12px;
  color: var(--ink-light);
}

.notification-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ink-light);
}

/* ================================
   Login Screen
   ================================ */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  padding-top: calc(var(--space-xl) * 2);
  padding-bottom: 0;
}

.login-brand {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo {
  width: 80px;
  height: 80px;
  background: var(--sea);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.login-logo svg {
  width: 48px;
  height: 48px;
  color: var(--white);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
}

.login-subtitle {
  font-size: 15px;
  color: var(--ink-light);
  margin-top: var(--space-xs);
}

.login-form {
  flex: 1;
}

.login-form .form-group {
  margin-bottom: var(--space-lg);
}

.login-form .btn {
  margin-top: var(--space-md);
}

.login-footer {
  text-align: center;
  padding: var(--space-lg) 0;
  font-size: 13px;
  color: var(--ink-light);
}

.login-footer a {
  color: var(--sea);
  font-weight: 500;
}

/* ================================
   Empty States
   ================================ */
.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--mist);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  color: var(--ink-light);
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.empty-state-message {
  font-size: 14px;
  color: var(--ink-light);
}

/* ================================
   Utility Classes
   ================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

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

.mt-auto {
  margin-top: auto;
}

.mb-0 {
  margin-bottom: 0;
}
