/* =====================================================
   SlotIn v2 — App CSS (Admin / Teacher / Member)
   Professional SaaS Blue Design System
   ===================================================== */

/* ===== APP LAYOUT ===== */
.app-body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F1F5F9;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-layout {
  display: flex;
  flex: 1;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

/* ===== APP HEADER ===== */
.app-header {
  height: 60px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.app-header__logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.app-header__search {
  flex: 1;
  max-width: 400px;
  margin-left: 1rem;
  position: relative;
}
.app-header__search input {
  width: 100%;
  padding: .5rem 1rem .5rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  background: var(--bg);
  outline: none;
  transition: border-color .2s;
}
.app-header__search input:focus { border-color: var(--primary); }
.app-header__search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.app-header__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.app-header__notif {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: .375rem;
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.app-header__notif:hover { background: var(--bg); }
.notif-badge {
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  background: var(--danger);
  color: white;
  font-size: .625rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-header__user {
  display: flex;
  align-items: center;
  gap: .625rem;
  cursor: pointer;
  padding: .375rem .75rem;
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.app-header__user:hover { background: var(--bg); }
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  font-weight: 700;
}
.user-info { line-height: 1.3; }
.user-name { font-size: .875rem; font-weight: 600; color: var(--text); }
.user-role { font-size: .75rem; color: var(--text-muted); }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar__section-label {
  font-size: .6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .75rem 1.25rem .375rem;
  margin-top: .25rem;
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  width: 100%;
  border-radius: 0;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar__item:hover { background: var(--bg); color: var(--text); }
.sidebar__item.is-active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.sidebar__item.is-active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.sidebar__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar__bottom {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.sidebar__plan {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  padding: 1rem;
  color: white;
  font-size: .8125rem;
  margin-bottom: .75rem;
}
.sidebar__plan-title { font-weight: 700; margin-bottom: .25rem; display: flex; align-items: center; gap: .375rem; }
.sidebar__plan-desc { opacity: .8; font-size: .75rem; margin-bottom: .75rem; }

/* ===== MAIN CONTENT ===== */
.app-content {
  flex: 1;
  overflow: hidden;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}
.page-section { display: none; }
.page-section.is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.page-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ===== CARDS ===== */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.stat-card__icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card__body { flex: 1; min-width: 0; }
.stat-card__label { font-size: .8125rem; color: var(--text-muted); margin-bottom: .25rem; }
.stat-card__value {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  font-family: 'Inter', 'Pretendard', sans-serif;
}
.stat-card__change {
  font-size: .75rem;
  font-weight: 600;
  margin-top: .25rem;
}
.stat-card__change.up { color: var(--accent); }
.stat-card__change.down { color: var(--danger); }

/* ===== TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  background: var(--bg);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .625rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
}
.badge--blue { background: var(--primary-light); color: var(--primary); }
.badge--green { background: #DCFCE7; color: #16A34A; }
.badge--yellow { background: #FEF9C3; color: #CA8A04; }
.badge--red { background: #FEE2E2; color: #DC2626; }
.badge--gray { background: var(--bg); color: var(--text-muted); }

/* ===== CALENDAR ===== */
.week-calendar {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.week-calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.week-calendar__nav { display: flex; align-items: center; gap: .75rem; }
.week-calendar__title { font-size: 1rem; font-weight: 700; color: var(--text); }
.week-calendar__nav-btn {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all .2s;
}
.week-calendar__nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.week-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  overflow-x: auto;
}
.week-grid__time-col { border-right: 1px solid var(--border); }
.week-grid__day-header {
  padding: .75rem .5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.week-grid__day-header.today { background: var(--primary-light); }
.week-grid__day-name { font-size: .75rem; color: var(--text-muted); font-weight: 600; }
.week-grid__day-date {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text);
  font-family: 'Inter', sans-serif;
}
.week-grid__day-header.today .week-grid__day-date { color: var(--primary); }
.week-grid__time-header {
  padding: .75rem .5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.week-grid__time-slot {
  height: 42px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: .25rem .375rem;
  font-size: .6875rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  background: var(--bg);
}
.week-grid__cell {
  height: 42px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: .25rem;
  position: relative;
}
.week-grid__cell:hover { background: #F8FAFF; }
.booking-chip {
  border-radius: 4px;
  padding: .25rem .5rem;
  font-size: .6875rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: opacity .15s;
}
.booking-chip:hover { opacity: .85; }
.booking-chip--pt { background: #DBEAFE; color: #1D4ED8; border-left: 3px solid #2563EB; }
.booking-chip--pilates { background: #F0FDF4; color: #15803D; border-left: 3px solid #22C55E; }
.booking-chip--yoga { background: #FDF4FF; color: #7E22CE; border-left: 3px solid #A855F7; }
.booking-chip--crossfit { background: #FFF7ED; color: #C2410C; border-left: 3px solid #F97316; }

/* ===== BOTTOM NAV (MOBILE) ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 50;
  padding: .5rem 0 env(safe-area-inset-bottom, .5rem);
}
.bottom-nav__items {
  display: flex;
  justify-content: space-around;
}
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .5rem .75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .6875rem;
  font-weight: 500;
  font-family: inherit;
  transition: color .2s;
  min-width: 60px;
}
.bottom-nav__item.is-active { color: var(--primary); }
.bottom-nav__item svg { width: 22px; height: 22px; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .375rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color .2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.96);
  transition: transform .2s;
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.125rem; font-weight: 800; color: var(--text); }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-footer {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ===== MEMBER CARD (mobile app style) ===== */
.member-app {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 80px;
}
.member-app .app-header {
  background: white;
}
.membership-card {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: white;
  margin-bottom: 1.25rem;
}
.membership-card__label { font-size: .8125rem; opacity: .8; margin-bottom: .25rem; }
.membership-card__name { font-size: 1.125rem; font-weight: 800; margin-bottom: 1rem; }
.membership-card__row { display: flex; justify-content: space-between; align-items: flex-end; }
.membership-card__sessions { }
.membership-card__sessions-num {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
  font-family: 'Inter', sans-serif;
}
.membership-card__sessions-label { font-size: .8125rem; opacity: .8; }
.membership-card__progress {
  margin-top: .75rem;
  background: rgba(255,255,255,.25);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
}
.membership-card__progress-bar {
  height: 100%;
  background: white;
  border-radius: 100px;
  transition: width .6s ease;
}
.membership-card__trainer { text-align: right; }
.membership-card__trainer-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-left: auto;
  margin-bottom: .25rem;
}
.membership-card__trainer-name { font-size: .8125rem; font-weight: 600; }

/* ===== RESPONSIVE APP ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .bottom-nav { display: block; }
  .app-content { padding: 1rem; padding-bottom: 80px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .week-grid { grid-template-columns: 50px repeat(7, minmax(80px, 1fr)); }
  .app-header__search { display: none; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card__value { font-size: 1.25rem; }
}
