/* =========================================================
   SharedSpace Student Portal - Apple HIG Design System
   Matches Admin Landlord Portal tokens and design language
   ========================================================= */

/* Top alignment when student page is active */
#app:has(.student-page) {
  align-self: flex-start;
}

.student-page {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  color: var(--apple-text-primary);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.student-page h1,
.student-page h2,
.student-page h3,
.student-page p {
  margin: 0;
}

.student-page .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* =========================================================
   Apple Eyebrows, Page Headers & Hero Profile Card
   ========================================================= */
.student-page .eyebrow,
.student-page .apple-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--apple-blue);
  margin-bottom: 4px;
}

.student-page .student-header,
.student-page .apple-profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--apple-surface);
  border: 1px solid var(--apple-border);
  border-radius: 20px;
  box-shadow: var(--apple-shadow);
  padding: 18px 22px;
  margin-bottom: 8px;
}

.student-page .student-header-text {
  min-width: 0;
  flex: 1;
}

.student-page .student-header h2,
.student-page .page-title,
.student-page .apple-profile-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--apple-text-primary);
}

.student-page .student-subtitle,
.student-page .apple-profile-subtitle {
  font-size: 14px;
  color: var(--apple-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

/* Apple Avatar */
.student-page .avatar,
.student-page .apple-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007aff, #5ac8fa);
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
  text-transform: uppercase;
}

.student-page .avatar-small,
.student-page .apple-avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 14px;
  box-shadow: none;
}

/* =========================================================
   Apple Cards & Inset Containers
   ========================================================= */
.student-page .card,
.student-page .apple-card {
  margin-top: 16px;
  padding: 20px;
  background-color: var(--apple-surface);
  border: 1px solid var(--apple-border);
  border-radius: 20px;
  box-shadow: var(--apple-shadow);
}

.student-page .card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.student-page h3,
.student-page .apple-room-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--apple-text-primary);
}

.student-page .card-title-row a,
.student-page .apple-section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--apple-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 980px;
  background: rgba(0, 122, 255, 0.08);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.student-page .card-title-row a:hover,
.student-page .apple-section-link:hover {
  background: rgba(0, 122, 255, 0.16);
}

.student-page .card-subtitle,
.student-page .apple-room-node {
  font-size: 13px;
  color: var(--apple-text-secondary);
  margin-bottom: 12px;
}

/* Apple Inset List */
.student-page .apple-inset-list {
  background: var(--apple-surface);
  border: 1px solid var(--apple-border);
  border-radius: 18px;
  box-shadow: var(--apple-shadow);
  overflow: hidden;
  margin-top: 10px;
}

.student-page .empty,
.student-page .apple-state-card {
  padding: 20px;
  background: var(--apple-surface);
  border: 1px solid var(--apple-border);
  border-radius: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--apple-text-secondary);
  box-shadow: var(--apple-shadow);
  margin-top: 10px;
}

/* =========================================================
   Apple Badges & Pills
   ========================================================= */
.student-page .pill,
.student-page .apple-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: capitalize;
  white-space: nowrap;
}

/* Tag colors & Semantic Badges */
.student-page .tag-green,
.student-page .apple-badge.paid,
.student-page .apple-badge.done {
  background-color: rgba(52, 199, 89, 0.14);
  color: #1f8b3c;
}

.student-page .tag-amber,
.student-page .apple-badge.pending,
.student-page .apple-badge.todo {
  background-color: rgba(255, 149, 0, 0.14);
  color: #b86200;
}

.student-page .tag-red,
.student-page .apple-badge.overdue,
.student-page .apple-badge.missed {
  background-color: rgba(255, 59, 48, 0.14);
  color: var(--apple-red);
}

/* Apple Status Pill (Live / Status indicators) */
.student-page .apple-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.student-page .apple-status-pill.online {
  background: rgba(52, 199, 89, 0.14);
  color: #1f8b3c;
}

.student-page .apple-status-pill.offline {
  background: rgba(255, 59, 48, 0.12);
  color: var(--apple-red);
}

.student-page .apple-status-dot,
.student-page .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #34c759;
  flex-shrink: 0;
  display: inline-block;
}

.student-page .apple-status-dot.pulsing {
  box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7);
  animation: applePulse 2s infinite;
}

@keyframes applePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(52, 199, 89, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
  }
}

/* =========================================================
   Sensor Readings & Metrics Grid
   ========================================================= */
.student-page .reading-grid,
.student-page .apple-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.student-page .reading,
.student-page .apple-metric-tile {
  background-color: var(--apple-tile-bg);
  border-radius: 14px;
  padding: 14px 16px;
  transition: background-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.student-page .reading-green {
  background-color: var(--apple-tile-bg);
}

.student-page .reading-amber {
  background-color: rgba(255, 149, 0, 0.12);
}

.student-page .reading-label,
.student-page .apple-metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--apple-text-secondary);
  margin-bottom: 6px;
}

.student-page .reading-label .icon {
  color: var(--apple-blue);
}

.student-page .reading-value,
.student-page .apple-metric-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--apple-text-primary);
  font-variant-numeric: tabular-nums;
  margin: 2px 0 6px;
}

.student-page .reading-value span,
.student-page .apple-metric-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--apple-text-secondary);
  margin-left: 2px;
}

.student-page .reading-status,
.student-page .apple-metric-status {
  font-size: 12px;
  font-weight: 600;
  margin-top: auto;
}

.student-page .reading-green .reading-status,
.student-page .apple-metric-status.reading-green {
  color: #1f8b3c;
}

.student-page .reading-amber .reading-status,
.student-page .apple-metric-status.reading-amber {
  color: #b86200;
}

/* The status text shares the tile's colour class: only the tile gets the background */
.student-page .apple-metric-status.reading-green,
.student-page .apple-metric-status.reading-amber {
  background-color: transparent;
}

.student-page .sensor-footer,
.student-page .apple-room-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--apple-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.student-page .sensor-footer-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* =========================================================
   Active Duties List (Home Page)
   ========================================================= */
.student-page .duty-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.student-page .duty-list li,
.student-page .apple-duty-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--apple-border);
  transition: background-color 0.15s ease;
}

.student-page .duty-list li:first-child {
  border-top: none;
}

/* Inset list row variant */
.student-page .apple-inset-list .apple-duty-row {
  padding: 13px 18px;
  border-top: none;
  border-bottom: 1px solid var(--apple-border);
}

.student-page .apple-inset-list .apple-duty-row:last-child {
  border-bottom: none;
}

.student-page .apple-inset-list .apple-duty-row:hover {
  background-color: rgba(0, 0, 0, 0.015);
}

/* iOS Check Circle */
.student-page .check-circle,
.student-page .apple-check-circle {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  background-color: var(--apple-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease,
    transform 0.12s ease;
}

.student-page .check-circle .check-icon,
.student-page .apple-check-circle .check-icon {
  width: 14px;
  height: 14px;
}

.student-page .check-circle:hover,
.student-page .apple-check-circle:hover {
  border-color: var(--apple-green);
  background-color: rgba(52, 199, 89, 0.14);
  color: #1f8b3c;
}

.student-page .check-circle:active,
.student-page .apple-check-circle:active {
  transform: scale(0.92);
}

.student-page .apple-duty-info,
.student-page .duty-list li > div {
  flex: 1;
  min-width: 0;
}

.student-page .duty-name,
.student-page .apple-duty-name,
.student-page .chore-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--apple-text-primary);
  line-height: 1.3;
}

.student-page .duty-due,
.student-page .apple-duty-due,
.student-page .chore-due {
  font-size: 13px;
  color: var(--apple-text-secondary);
  margin-top: 2px;
}

.student-page .late {
  color: var(--apple-red);
  font-weight: 600;
}

/* =========================================================
   Apple Buttons
   ========================================================= */
.student-page .apple-btn {
  appearance: none;
  border: none;
  border-radius: 980px;
  padding: 8px 16px;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background-color 0.16s ease,
    transform 0.12s ease;
}

.student-page .apple-btn:active {
  transform: scale(0.97);
}

.student-page .apple-btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}

.student-page .apple-btn-primary {
  background: var(--apple-blue);
  color: #ffffff;
  font-weight: 600;
}

.student-page .apple-btn-primary:hover {
  background: #0066d6;
}

.student-page .apple-btn-tinted,
.student-page .done-btn {
  background: rgba(0, 122, 255, 0.12);
  color: var(--apple-blue);
  border: none;
  border-radius: 980px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    transform 0.12s ease;
}

.student-page .apple-btn-tinted:hover,
.student-page .done-btn:hover {
  background: rgba(0, 122, 255, 0.2);
}

.student-page .apple-btn-tinted:active,
.student-page .done-btn:active {
  transform: scale(0.96);
}

/* =========================================================
   iOS Segmented Control Tabs (ChoresPage.js)
   ========================================================= */
.student-page .tabs,
.student-page .apple-segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  border-radius: 12px;
  background-color: var(--apple-tile-bg);
  border: 1px solid var(--apple-border);
}

.student-page .tab,
.student-page .apple-segment-btn {
  appearance: none;
  border: none;
  margin: 0;
  padding: 8px 12px;
  border-radius: 9px;
  background-color: transparent;
  color: var(--apple-text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-page .tab:hover,
.student-page .apple-segment-btn:hover {
  color: var(--apple-text-primary);
}

.student-page .tab.active,
.student-page .apple-segment-btn.active {
  background-color: var(--apple-surface);
  color: var(--apple-text-primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* =========================================================
   Apple Summary & Progress Card (Chores & Rent)
   ========================================================= */
.student-page .progress-card,
.student-page .apple-summary-card {
  margin-top: 16px;
  padding: 20px;
  border-radius: 20px;
  background: var(--apple-surface);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow);
}

.student-page .progress-title,
.student-page .apple-summary-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--apple-text-primary);
}

.student-page .progress-text,
.student-page .apple-summary-subtitle {
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--apple-text-secondary);
}

.student-page .progress-bar,
.student-page .apple-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 980px;
  background-color: var(--apple-tile-bg);
}

.student-page .progress-fill,
.student-page .apple-progress-fill {
  height: 100%;
  border-radius: 980px;
  background: linear-gradient(90deg, #007aff, #34c759);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Section Headings */
.student-page .list-heading,
.student-page .apple-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 4px 10px;
}

.student-page .list-heading h3,
.student-page .apple-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--apple-text-secondary);
  margin: 0;
}

.student-page .list-heading span,
.student-page .apple-section-meta {
  font-size: 12px;
  color: var(--apple-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   Chore & Payment List Items
   ========================================================= */
.student-page .chore-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.student-page .chore-card,
.student-page .apple-chore-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background-color: var(--apple-surface);
  border: 1px solid var(--apple-border);
  border-radius: 18px;
  box-shadow: var(--apple-shadow);
  transition: background-color 0.15s ease;
}

.student-page .chore-icon,
.student-page .apple-icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: var(--apple-tile-bg);
  color: var(--apple-text-secondary);
}

.student-page .chore-icon.done,
.student-page .apple-icon-tile.done {
  background-color: rgba(52, 199, 89, 0.14);
  color: #1f8b3c;
}

.student-page .apple-icon-tile.rent {
  background-color: rgba(0, 122, 255, 0.12);
  color: var(--apple-blue);
}

.student-page .apple-icon-tile.fine {
  background-color: rgba(255, 149, 0, 0.14);
  color: #b86200;
}

.student-page .chore-info,
.student-page .apple-chore-details {
  flex: 1;
  min-width: 0;
}

.student-page .chore-due {
  margin: 2px 0 6px;
}

.student-page .chore-actions,
.student-page .apple-chore-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.student-page .done-note,
.student-page .apple-chore-completed-note {
  margin-top: 4px;
  font-size: 12px;
  color: #1f8b3c;
  font-weight: 500;
}

/* =========================================================
   Rent Page Special Styles
   ========================================================= */
.student-page .total-amount,
.student-page .apple-wallet-balance {
  margin: 4px 0 6px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--apple-text-primary);
  font-variant-numeric: tabular-nums;
}

.student-page .amount,
.student-page .apple-list-amount {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--apple-text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* =========================================================
   Toast Notification (iOS Dynamic Island Style)
   ========================================================= */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 10px 20px;
  border-radius: 980px;
  background-color: rgba(29, 29, 31, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition:
    opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}


/* ---------- Add chore form ---------- */
.student-page .add-chore-btn {
  width: 100%;
  margin: 14px 0 4px;
}

.student-page .add-chore-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.student-page .form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--apple-text-secondary);
}

.student-page .form-field select,
.student-page .form-field input {
  font: inherit;
  font-size: 16px; /* 16px stops iPhone zooming in on focus */
  font-weight: 500;
  color: var(--apple-text-primary);
  background-color: var(--apple-tile-bg);
  border: 1px solid var(--apple-border);
  border-radius: 12px;
  padding: 10px 14px;
  width: 100%;
  box-sizing: border-box;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.student-page .form-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 15px 15px;
}

.student-page .form-field select:hover:not(:disabled) {
  background-color: #e9e9ef;
  border-color: rgba(0, 0, 0, 0.14);
}

.student-page .form-field select:focus,
.student-page .form-field input:focus {
  outline: none;
  background-color: var(--apple-surface);
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.student-page .form-field select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23007aff' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.student-page .form-field small {
  font-weight: 400;
  color: var(--apple-text-tertiary);
}

.student-page .form-error {
  color: var(--apple-red);
  font-size: 13px;
  margin: 0;
}

.student-page .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
