﻿/* Mobile-first base styles */
:root {
  --brand: #10B981;
}

body {
  background: #F8FAFC;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  color: #1d4ed8;
}

/* Typography - mobile-first */
h1 {
  font-size: 1.75rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.25;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.3;
}

h4 {
  font-size: 1.1rem;
  line-height: 1.35;
}

p {
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Layout containers - mobile-first */
.container {
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Navigation - mobile-first */
.navbar.navbar-sticky {
  position: sticky;
  top: 0;
  z-index: 1040;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
  border-bottom: 1px solid rgba(148, 163, 184, .14);
  padding: 0.75rem 1rem;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
}

.navbar .navbar-toggler {
  border: none;
  padding: 0.5rem;
}

.navbar .navbar-toggler:focus {
  box-shadow: none;
}

.navbar-nav .nav-link {
  color: #1f2937;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  display: block;
}

.navbar-nav .nav-link:hover {
  color: #2563eb;
  background: rgba(37, 99, 235, .08);
}

.navbar-collapse {
  padding-top: 0.5rem;
}

/* Desktop navigation */
@media (min-width: 768px) {
  .navbar.navbar-sticky .navbar-nav {
    align-items: center;
    gap: 0.5rem;
    flex-direction: row !important;
  }
  
  .navbar.navbar-sticky .navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    border-radius: 999px;
  }
  
  .navbar-collapse {
    padding-top: 0;
  }
}

/* Mobile navigation menu */
@media (max-width: 767.98px) {
  #nav.collapse:not(.show) {
    display: none;
  }
  
  #nav.collapse.show {
    background: rgba(255, 255, 255, .98);
    border-radius: 16px;
    margin-top: 12px;
    padding: 12px 16px;
    box-shadow: 0 18px 32px rgba(15, 23, 42, .15);
  }
  
  .navbar.navbar-sticky .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Cards - mobile-first */
.card {
  border: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
  border-radius: 16px;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .card {
    border-radius: 20px;
  }
}

/* Buttons - mobile-first */
.btn {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
}

.btn-brand {
  background: var(--brand);
  color: #fff;
  border: 0;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.65rem 1.35rem;
}

.btn-brand:hover {
  opacity: .95;
  color: #fff;
}

.btn-outline-secondary {
  border-radius: 999px;
}

.btn-soft {
  border-radius: 999px;
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, .18);
  background: rgba(79, 70, 229, .08);
  color: #4338ca;
  transition: all .2s ease;
  font-size: 0.875rem;
}

.btn-soft:hover {
  background: rgba(79, 70, 229, .16);
  color: #312e81;
}

/* Badges */
.badge-soft {
  background: #ECFDF5;
  color: #065F46;
}

/* Hero section - mobile-first */
.page-hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 1.5rem 1rem;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%, #ecfeff 100%);
  border: 1px solid rgba(99, 102, 241, .12);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .05);
  margin-bottom: 1.5rem;
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, .12), transparent 55%);
  pointer-events: none;
}

.page-hero .hero-eyebrow {
  letter-spacing: .18em;
  font-size: .65rem;
  text-transform: uppercase;
  font-weight: 600;
  color: #64748b;
}

.page-hero h1 {
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  line-height: 1.2;
}

.page-hero p {
  color: #475569;
  font-size: .875rem;
  line-height: 1.5;
  margin-bottom: 0;
}

@media (min-width: 576px) {
  .page-hero {
    padding: 2rem 1.5rem;
  }
  
  .page-hero h1 {
    font-size: 1.75rem;
  }
}

@media (min-width: 768px) {
  .page-hero {
    padding: 2.25rem 2.5rem;
    border-radius: 24px;
  }
  
  .page-hero h1 {
    font-size: 2.1rem;
  }
  
  .page-hero .hero-eyebrow {
    font-size: .7rem;
  }
  
  .page-hero p {
    font-size: .95rem;
  }
}

/* Metrics grid - mobile-first */
.metric-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-top: 1.5rem;
}

@media (min-width: 576px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 992px) {
  .metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 1.75rem;
    gap: 1.25rem;
  }
}

.metric-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 16px 32px rgba(15, 23, 42, .04);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-card .metric-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #64748b;
  font-weight: 600;
}

.metric-card .metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.metric-card .metric-hint {
  font-size: .8rem;
  color: #475569;
}

@media (min-width: 768px) {
  .metric-card {
    padding: 1.5rem 1.75rem;
  }
  
  .metric-card .metric-value {
    font-size: 1.75rem;
  }
  
  .metric-card .metric-label {
    font-size: .75rem;
  }
  
  .metric-card .metric-hint {
    font-size: .85rem;
  }
}

/* Section titles - mobile-first */
.section-title {
  font-weight: 700;
  font-size: 1.25rem;
  color: #0f172a;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.section-subtitle {
  font-size: .875rem;
  color: #64748b;
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 1.3rem;
  }
  
  .section-subtitle {
    font-size: .9rem;
    margin-bottom: 1.5rem;
  }
}

/* Course cards - mobile-first */
.course-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 14px 32px rgba(15, 23, 42, .05);
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.course-card__badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 600;
  background: rgba(59, 130, 246, .12);
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.course-card__body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
}

.course-card__body h5 {
  font-weight: 700;
  color: #0f172a;
  font-size: 1.1rem;
  line-height: 1.3;
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.course-card__body p {
  color: #475569;
  font-size: .875rem;
  line-height: 1.5;
  margin-bottom: 0;
}

.course-card__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (min-width: 576px) {
  .course-card__body {
    padding: 1.5rem;
  }
  
  .course-card__body h5 {
    font-size: 1.25rem;
  }
  
  .course-card__body p {
    font-size: .9rem;
  }
}

@media (min-width: 768px) {
  .course-card {
    border-radius: 20px;
    margin-bottom: 0;
  }
  
  .course-card__badge {
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.75rem;
    font-size: .7rem;
  }
  
  .course-card__body {
    padding: 1.75rem;
    gap: 1rem;
  }
  
  .course-card__footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
  }
}

/* Check-in layout - mobile-first */
.checkin-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .checkin-layout {
    gap: 1.5rem;
  }
}

@media (min-width: 992px) {
  .checkin-layout {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
  }
}

.card-elevated {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .05);
  padding: 1.5rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

.status-chip.available {
  background: rgba(251, 191, 36, .2);
  color: #b45309;
}

.status-chip.booked {
  background: rgba(16, 185, 129, .18);
  color: #047857;
}

.status-chip.muted {
  background: rgba(148, 163, 184, .16);
  color: #475569;
}

/* Lesson stack - mobile-first */
.lesson-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.lesson-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 16px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .04);
  overflow: hidden;
}

.lesson-card h5 {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  padding: 1rem 1.25rem 0;
  margin-top: 0;
}

.lesson-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lesson-card li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid rgba(226, 232, 240, .8);
  font-size: .875rem;
  color: #334155;
}

.lesson-card li:first-child {
  border-top: 0;
}

.lesson-card li:last-child {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.lesson-card .actions {
  display: flex;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .lesson-card {
    border-radius: 18px;
  }
  
  .lesson-card h5 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    padding: 1.25rem 1.5rem 0;
  }
  
  .lesson-card li {
    padding: 1rem 1.5rem;
    font-size: .95rem;
  }
  
  .lesson-card li:last-child {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
  }
  
  .lesson-card .actions {
    gap: 0.75rem;
  }
}

/* Aside panel - mobile-first */
.aside-panel {
  position: static;
  background: linear-gradient(180deg, rgba(59, 130, 246, .08), rgba(59, 130, 246, .02));
  border-radius: 16px;
  border: 1px solid rgba(59, 130, 246, .16);
  box-shadow: 0 14px 28px rgba(59, 130, 246, .12);
  padding: 1.5rem;
  color: #1e3a8a;
  margin-top: 1.5rem;
}

.aside-panel h6 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.aside-panel p {
  color: #1e40af;
  font-size: .875rem;
  line-height: 1.5;
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .aside-panel {
    padding: 1.75rem;
  }
  
  .aside-panel p {
    font-size: .9rem;
  }
}

@media (min-width: 992px) {
  .aside-panel {
    position: sticky;
    top: 5rem;
    margin-top: 0;
  }
}

/* Toast notifications - mobile-first */
.habit-toast {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  background: #0f172a;
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 22px 45px rgba(15, 23, 42, .35);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 1050;
  text-align: center;
}

.habit-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.habit-toast.is-error {
  background: #b91c1c;
}

@media (min-width: 576px) {
  .habit-toast {
    left: auto;
    right: 1.5rem;
    width: auto;
    max-width: 320px;
    text-align: left;
  }
}

/* Forms - mobile-first */
.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #1e293b;
  background-color: #ffffff;
  background-clip: padding-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
  min-height: 44px;
}

.form-control:focus {
  color: #1e293b;
  background-color: #ffffff;
  border-color: #93c5fd;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Footer */
.footer {
  color: #6B7280;
  font-size: 14px;
  padding: 1rem;
  text-align: center;
}

/* Touch device enhancements */
@media (hover: none), (hover: on-demand) {
  .btn, .nav-link, .status-chip, .btn-soft, .btn-brand {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  .nav-link {
    padding: 0.875rem 1rem;
  }
  
  .btn-brand, .btn-soft {
    padding: 0.75rem 1.5rem;
  }
  
  /* Larger touch targets for mobile */
  .form-control {
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
  body {
    font-size: 15px;
  }
  
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .page-hero {
    padding: 1.25rem 0.875rem;
    border-radius: 12px;
  }
  
  .page-hero h1 {
    font-size: 1.35rem;
  }
  
  .metric-card {
    padding: 1rem 1.25rem;
  }
  
  .metric-card .metric-value {
    font-size: 1.35rem;
  }
  
  .course-card {
    border-radius: 14px;
  }
  
  .course-card__body {
    padding: 1rem;
  }
  
  .lesson-card {
    border-radius: 14px;
  }
  
  .lesson-card h5 {
    font-size: 1rem;
    padding: 0.875rem 1rem 0;
  }
  
  .lesson-card li {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
  
  .lesson-card li:last-child {
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
  }
  
  .card-elevated {
    border-radius: 16px;
    padding: 1.25rem;
  }
  
  .aside-panel {
    border-radius: 14px;
    padding: 1.25rem;
  }
  
  .navbar.navbar-sticky {
    padding: 0.625rem 0.75rem;
  }
  
  .navbar-brand {
    font-size: 1.125rem;
  }
  
  .navbar-nav .nav-link {
    padding: 0.625rem 0.875rem;
  }
}