/* BodyMind OS — App Stylesheet */
:root {
  --bg: #fafaf8;
  --bg-card: #ffffff;
  --bg-section: #f5f3ef;
  --bg-input: #f0ede7;
  --border: #e0dcd4;
  --border-light: #ece8e0;
  --text: #2d2a26;
  --text-muted: #6b6560;
  --text-dim: #9a948c;
  --primary: #5b8a72;
  --primary-hover: #4a7360;
  --primary-bg: rgba(91, 138, 114, 0.1);
  --accent: #c4915e;
  --accent-hover: #b07d4a;
  --accent-bg: rgba(196, 145, 94, 0.1);
  --success: #5b8a72;
  --success-bg: rgba(91, 138, 114, 0.12);
  --warning: #d4a04a;
  --warning-bg: rgba(212, 160, 74, 0.12);
  --danger: #c45c5c;
  --danger-bg: rgba(196, 92, 92, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Splash / License Gate */
#splash {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #fafaf8 0%, #eeebe4 100%);
}

.splash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.splash-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.splash-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.splash-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}

.splash-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.splash-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-section); color: var(--text); }

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
label {
  display: block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea { resize: vertical; min-height: 80px; }

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

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

.form-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* App Layout */
#app {
  display: none;
  min-height: 100vh;
}

#app.visible {
  display: block;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tier-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.tier-free {
  background: var(--bg-section);
  color: var(--text-muted);
}

.tier-pro, .tier-studio {
  background: var(--primary-bg);
  color: var(--primary);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0;
  background: none;
  border: none;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s;
}

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

.nav-item .nav-icon {
  font-size: 20px;
}

/* Content Area */
#app-content {
  padding: 24px 24px 80px;
  max-width: 800px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

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

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

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

/* Page titles */
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

/* Client list */
.client-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.client-item:last-child { border-bottom: none; }

.client-name {
  font-weight: 500;
  font-size: 14px;
}

.client-meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 20px;
}

.calendar-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 0;
}

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

.calendar-day:hover { background: var(--bg-section); }

.calendar-day.today {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.calendar-day.has-events::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

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

.appointment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.appointment-time {
  font-weight: 600;
  font-size: 13px;
  min-width: 60px;
}

.appointment-info { flex: 1; }

.appointment-client {
  font-weight: 500;
  font-size: 14px;
}

.appointment-type {
  font-size: 12px;
  color: var(--text-dim);
}

/* Intake form */
.intake-section {
  margin-bottom: 24px;
}

.intake-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.checkbox-item input { width: auto; }

.checkbox-item.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.contraindication-alert {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.contraindication-alert .alert-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Session notes */
.soap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.soap-section {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.soap-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 8px;
}

.soap-section textarea {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 60px;
}

/* CE Tracker */
.ce-progress {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  height: 12px;
  overflow: hidden;
  margin: 8px 0;
}

.ce-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-sm);
  transition: width 0.3s;
}

.ce-stat {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

/* Dashboard stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

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

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Upgrade banner */
.upgrade-banner {
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.upgrade-banner p {
  font-size: 14px;
  color: var(--text);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}

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

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* Responsive */
@media (min-width: 768px) {
  .bottom-nav {
    position: static;
    border-top: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    padding: 0 24px;
    gap: 0;
  }

  .nav-item {
    flex-direction: row;
    gap: 6px;
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 2px solid transparent;
  }

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

  #app-content {
    padding-bottom: 24px;
  }
}

.hidden { display: none !important; }
