:root {
  --tg-bg: var(--tg-theme-bg-color, #ffffff);
  --tg-text: var(--tg-theme-text-color, #000000);
  --tg-hint: var(--tg-theme-hint-color, #999999);
  --tg-link: var(--tg-theme-link-color, #2481cc);
  --tg-button: var(--tg-theme-button-color, #2481cc);
  --tg-button-text: var(--tg-theme-button-text-color, #ffffff);
  
  --primary: #ff6b35;
  --primary-dark: #e55a2b;
  --secondary: #4a5568;
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #f56565;
  --gray-100: #f7fafc;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
  --gray-400: #cbd5e0;
  --gray-500: #a0aec0;
  --gray-600: #718096;
  --gray-700: #4a5568;
  --gray-800: #2d3748;
  --gray-900: #1a202c;
  
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* Screens */
.screen {
  display: none;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* Loading */
#loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
}

#loading.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Header */
.header {
  margin-bottom: 20px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--gray-500);
  font-size: 16px;
}

.header.compact {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.header.compact h1 {
  font-size: 20px;
  margin: 0;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 12px;
}

/* Packages Card */
.packages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.package-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
}

.package-name {
  font-weight: 500;
  color: var(--gray-700);
}

.package-count {
  font-weight: 700;
  color: var(--primary);
}

.package-count.low {
  color: var(--danger);
}

.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 2px solid var(--gray-200);
  font-weight: 600;
  color: var(--gray-700);
}

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

/* This Week Card */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.bookings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.booking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
}

.booking-date {
  text-align: center;
  min-width: 48px;
}

.booking-day {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
}

.booking-date-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
}

.booking-time {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
}

.booking-type {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.booking-type.trial {
  background: #c6f6d5;
  color: #276749;
}

.booking-type.paid {
  background: #bee3f8;
  color: #2c5282;
}

.no-bookings {
  text-align: center;
  color: var(--gray-500);
  padding: 20px;
  font-style: italic;
}

/* Buttons */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

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

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

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-100);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
}

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

.btn-full {
  width: 100%;
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
}

.btn .text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.btn .text strong {
  font-size: 15px;
}

.btn .text small {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.8;
}

.btn .icon {
  font-size: 24px;
}

.btn-back {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--gray-200);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Date Selector */
.date-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.date-selector::-webkit-scrollbar {
  display: none;
}

.date-option {
  flex-shrink: 0;
  width: 64px;
  padding: 12px 8px;
  background: var(--gray-100);
  border: 2px solid transparent;
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.date-option:hover {
  background: var(--gray-200);
}

.date-option.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}

.date-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.date-option .day {
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.date-option .date-num {
  font-size: 20px;
  font-weight: 700;
}

.date-option .slots {
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.8;
}

/* Time Grid */
.time-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.time-option {
  padding: 12px;
  background: var(--gray-100);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.time-option:hover {
  background: var(--gray-200);
}

.time-option.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}

.time-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Confirmation */
.confirmation-box {
  text-align: center;
  padding: 24px;
  background: var(--gray-100);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.confirm-date {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.confirm-time {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.confirm-type {
  font-size: 14px;
  color: var(--gray-500);
}

/* Packages Grid */
.packages-grid {
  display: grid;
  gap: 12px;
}

.package-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  border: 2px solid var(--gray-200);
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.package-card:hover {
  border-color: var(--primary);
}

.package-card.popular {
  border-color: var(--primary);
  background: linear-gradient(135deg, #fff5f2 0%, #ffffff 100%);
}

.popular-badge {
  position: absolute;
  top: -1px;
  right: 12px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 0 0 8px 8px;
}

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

.package-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
}

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

.per-session {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.savings {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 12px;
}

/* Payment */
.payment-summary {
  background: var(--primary);
  color: white;
}

.payment-summary h3 {
  color: rgba(255,255,255,0.8);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.payment-icon {
  font-size: 24px;
}

.payment-details {
  flex: 1;
}

.payment-details strong {
  display: block;
  font-size: 15px;
  color: var(--gray-800);
}

.payment-details small {
  font-size: 13px;
  color: var(--gray-500);
}

.instructions {
  padding-left: 20px;
  line-height: 2;
  color: var(--gray-700);
}

.instructions li {
  margin-bottom: 4px;
}

/* Success Screen */
#success {
  text-align: center;
  padding-top: 60px;
}

.success-animation {
  margin-bottom: 24px;
}

.checkmark {
  width: 80px;
  height: 80px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: white;
  margin: 0 auto;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

#success h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

#success p {
  color: var(--gray-500);
  margin-bottom: 32px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 360px) {
  .header h1 {
    font-size: 24px;
  }
  
  .time-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}