/* ---- CSS Variables ---- */
:root {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --text: #111111;
  --text-muted: #777777;
  --border: #111111;
  --border-subtle: #dddddd;
  --accent: #111111;
  --error: #cc0000;
  --nav-h: 64px;
  --header-h: 52px;
}

[data-theme="dark"] {
  --bg: #111111;
  --surface: #1c1c1c;
  --text: #f0f0f0;
  --text-muted: #888888;
  --border: #f0f0f0;
  --border-subtle: #333333;
  --accent: #f0f0f0;
  --error: #ff7777;
}

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

html {
  height: 100%;
}

body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  font-family: inherit;
}

/* ---- Centered Screens (password, onboarding, etc.) ---- */
.screen-centered {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.screen-centered .inner {
  width: 100%;
  max-width: 360px;
}

/* ---- Cards ---- */
.card {
  border: 2px solid var(--border);
  padding: 24px;
}

/* ---- Typography ---- */
.app-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.app-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.screen-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.screen-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  border-radius: 0;
}

.form-input::placeholder {
  color: var(--text-muted);
}

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

.form-select {
  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='%23111111' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

[data-theme="dark"] .form-select {
  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='%23f0f0f0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(var(--invert, 0));
  cursor: pointer;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.form-input[type="number"] {
  -moz-appearance: textfield;
}

.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* ---- Buttons ---- */
.btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 0;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  font-size: 13px;
}

.btn-sm {
  padding: 9px 14px;
  font-size: 12px;
}

.btn + .btn {
  margin-top: 10px;
}

.btn-danger {
  background: var(--bg);
  color: var(--error);
  border-color: var(--error);
}

/* ---- Error / Info Messages ---- */
.error-msg {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 12px;
}

.info-msg {
  font-size: 14px;
  color: var(--text-muted);
  padding: 12px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ---- Main App Layout ---- */
.main-layout {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.main-header {
  height: var(--header-h);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.main-header__titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  flex: 1;
  min-width: 0;
  margin-right: 12px;
}

.main-header__title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-header__center {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.header-theme-btn {
  background: none;
  border: 2px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-content {
  padding: 20px 16px 100px;
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 8px;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}

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

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Home Tab ---- */
.streak-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--border);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.streak-badge--zero {
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.motivational-msg {
  font-size: 14px;
  line-height: 1.6;
  padding: 14px;
  border: 2px solid var(--border);
  margin-bottom: 24px;
  background: var(--surface);
}

.progress-section {
  margin-bottom: 8px;
}

.module-section {
  margin-bottom: 28px;
}

.module-section__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.module-section__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.module-section__done {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.progress-item {
  margin-bottom: 18px;
}

.progress-item__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}

.progress-item__label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.progress-item__count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.progress-item__count--done {
  color: var(--text);
  font-weight: 700;
}

.progress-bar {
  height: 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ---- FAB Log Button ---- */
.fab-container {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  z-index: 90;
}

/* ---- Log Hours Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.modal {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  max-height: 92dvh;
  background: var(--bg);
  border-top: 2px solid var(--border);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: 2px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  line-height: 1;
}

.log-entry {
  border: 2px solid var(--border-subtle);
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}

.log-entry__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  font-family: inherit;
}

.duration-row {
  display: flex;
  gap: 8px;
}

.duration-row .form-input {
  flex: 1;
}

.unit-select {
  width: 90px;
  flex-shrink: 0;
}

.add-entry-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: 2px dashed var(--border-subtle);
  width: 100%;
  padding: 12px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Weekly View ---- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.week-nav__label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  flex: 1;
}

.week-nav__btn {
  background: none;
  border: 2px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.week-day {
  display: flex;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.week-day:last-child {
  border-bottom: none;
}

.week-day__left {
  min-width: 52px;
  flex-shrink: 0;
}

.week-day__name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.week-day__date {
  font-size: 11px;
  color: var(--text-muted);
}

.week-day.today .week-day__name,
.week-day.today .week-day__date {
  color: var(--text);
}

.today-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--text);
  border-radius: 50%;
  margin-left: 3px;
  vertical-align: middle;
  margin-bottom: 1px;
}

.week-day__entries {
  flex: 1;
  padding-top: 1px;
}

.week-day__entry {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.4;
}

.week-day__empty {
  font-size: 13px;
  color: var(--text-muted);
}

/* Edit Hours: adjust amounts by date */
.edit-help {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.edit-amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.edit-amount-row__label {
  font-size: 14px;
  color: var(--text);
}
.edit-amount-input {
  width: 80px;
  text-align: center;
}
.edit-amount-dur {
  display: flex;
  gap: 6px;
  align-items: center;
}
.edit-amount-dur .edit-amount-input {
  width: 70px;
}
.edit-amount-dur .unit-select {
  width: auto;
}
.edit-empty {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* ---- Profile Tab ---- */
.profile-block {
  border: 2px solid var(--border);
  margin-bottom: 20px;
}

.profile-block__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
}

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

.profile-row__label {
  color: var(--text-muted);
}

.profile-row__value {
  font-weight: 600;
  text-align: right;
}

.danger-zone {
  margin-top: 32px;
}

/* ---- Feedback Modal ---- */
.sentiment-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.sentiment-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  flex: 1;
  transition: border-color 0.15s, background 0.15s;
}

.sentiment-btn:hover {
  border-color: var(--sentiment-color);
}

.sentiment-btn[data-sentiment="great"].active  { border-color: #2d7a4f; background: rgba(45,122,79,0.12); }
.sentiment-btn[data-sentiment="good"].active   { border-color: #6aab7e; background: rgba(106,171,126,0.12); }
.sentiment-btn[data-sentiment="bad"].active    { border-color: #c97a7a; background: rgba(201,122,122,0.12); }
.sentiment-btn[data-sentiment="terrible"].active { border-color: #a33232; background: rgba(163,50,50,0.12); }

.sentiment-emoji {
  font-size: 28px;
  line-height: 1;
}

.sentiment-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ---- Blurred Preview (non-BB brands) ---- */
.blur-wrapper {
  position: relative;
}

.blur-content {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.blur-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  background: var(--bg);
  border: 2px solid var(--border);
  padding: 20px 16px;
  width: calc(100% - 32px);
  max-width: 300px;
  text-align: center;
}

.blur-banner p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

/* ---- Teacher Waitlist / Not Available Screens ---- */
.info-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.info-screen__icon {
  font-size: 40px;
  margin-bottom: 20px;
  line-height: 1;
}

.info-screen h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.info-screen p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 280px;
  margin: 0 auto 24px;
}

/* ---- Divider ---- */
.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 20px 0;
}

/* ---- Auth Screens ---- */
.auth-switch {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-decoration: underline;
}

.form-input--readonly {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 2px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 16px;
}

/* ---- Import Modal ---- */
.import-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.import-step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  flex-shrink: 0;
}

.import-step-dot.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.import-step-line {
  flex: 1;
  max-width: 64px;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 6px;
}

.import-step-line.active {
  background: var(--text);
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  padding: 32px 20px;
  cursor: pointer;
  gap: 6px;
  text-align: center;
  margin-bottom: 16px;
}

.upload-zone__arrow {
  font-size: 28px;
  color: var(--text-muted);
  line-height: 1;
}

.upload-zone__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.upload-zone__sub {
  font-size: 13px;
  color: var(--text-muted);
}

.import-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 12px 0;
}

.import-divider::before,
.import-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.import-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  padding: 12px 14px;
}

.import-preview-stats {
  border: 2px solid var(--border);
}

.import-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
}

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

.import-stat-label {
  color: var(--text-muted);
}

.import-stat-val {
  font-weight: 600;
}

.import-stat-row--total .import-stat-label,
.import-stat-row--total .import-stat-val {
  color: var(--text);
  font-weight: 700;
}

.import-stat-row--skipped .import-stat-label,
.import-stat-row--skipped .import-stat-val {
  color: var(--text-muted);
  font-style: italic;
}

.import-entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.import-entry-row:last-of-type {
  border-bottom: none;
}

.import-entry-date {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 95px;
}

.import-entry-type {
  color: var(--text);
  font-weight: 500;
}

.import-entry-more {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0 0;
}

.import-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 0 8px;
  gap: 8px;
}

.import-success__check {
  width: 56px;
  height: 56px;
  border: 2px solid var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.import-success__title {
  font-size: 20px;
  font-weight: 700;
}

.import-success__sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.import-home-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-top: 20px;
  padding: 12px 14px;
  background: none;
  border: 2px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.import-home-btn__sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.profile-import-btn {
  width: 100%;
  background: none;
  border: none;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-import-btn__sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ---- Utility ---- */
.mb-0 { margin-bottom: 0 !important; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 13px; }
