/* Kiosk Mode Styles - Touch-friendly for iPad */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ca8a04;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --white: #ffffff;
}

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

body {
  font-family: var(--font-family);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  min-height: 100vh;
  color: var(--gray-800);
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

.kiosk-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1024px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
}

/* Header */
.kiosk-header {
  text-align: center;
  padding: 0.5rem 0;
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  position: relative;
}

.kiosk-logo {
  width: 88px;
  height: 88px;
  border-radius: 6px;
  background: var(--white);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.kiosk-logo:empty {
  display: none;
}

.kiosk-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.kiosk-header h1 {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 700;
}

.kiosk-header .school-name {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  opacity: 0.9;
}

.kiosk-time {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  opacity: 0.7;
}

.kiosk-refresh-btn {
  background: none;
  border: none;
  color: var(--white);
  width: 88px;
  height: 88px;
  font-size: var(--font-h3);
  opacity: 0.15;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: opacity 0.2s;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}
.kiosk-refresh-btn:active { opacity: 0.6; }

/* Main Content */
.kiosk-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-top: 0.75rem;
}

/* Check-in Panel */
.checkin-panel {
  background: var(--white);
  border-radius: 24px;
  padding: 1.5rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: none;
}

.checkin-panel.active {
  display: block;
}

.panel-title {
  text-align: center;
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--gray-800);
}

.panel-label-search {
  text-align: center;
  font-size: var(--font-body-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 0.25rem;
}

.panel-label-search:empty {
  display: none;
}

.panel-subtitle-search {
  text-align: center;
  font-size: var(--font-h2);
  line-height: var(--lh-h2);
  color: var(--gray-500);
  margin: -0.75rem 0 1rem;
}

.panel-subtitle-search:empty {
  display: none;
}

.panel-title-search.combined-mode {
  font-size: var(--font-h2);
  line-height: var(--lh-h2);
}

/* Name Search */
.search-input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  border: 3px solid var(--gray-300);
  border-radius: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
}

.search-input::placeholder {
  color: var(--gray-300);
}

.search-results {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 16px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.search-result-item:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.search-result-item:active {
  transform: scale(0.98);
}

.member-avatar {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 700;
  color: var(--gray-600);
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.member-info {
  flex: 1;
}

.member-name {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 600;
  margin-bottom: 0.25rem;
}


.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--gray-600);
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
}

/* Success/Error Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--white);
  border-radius: 24px;
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: var(--font-h2);
  line-height: var(--lh-h2);
}

.modal-icon.success {
  background: #dcfce7;
  color: var(--success);
}

.modal-icon.error {
  background: #fee2e2;
  color: var(--danger);
}

.modal-icon.warning {
  background: #fef3c7;
  color: var(--warning);
}

.modal-title {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.modal-message {
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.modal-member-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gray-200);
  margin: 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-h2);
  line-height: var(--lh-h2);
  font-weight: 700;
  color: var(--gray-600);
}

.modal-member-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.modal-class-info {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-600);
  margin-top: 0.75rem;
}

/* Attendance Status Badge */
.modal-attendance-status {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
  margin-top: 1rem;
}

.modal-attendance-status.checked-in {
  background: #dcfce7;
  color: var(--success);
}

.modal-attendance-status.not-checked-in {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* Promotion Progress */
.modal-promotion {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1.5rem 1.5rem;
  background: var(--gray-100);
  border-radius: 16px;
}

.modal-promotion.eligible {
  background: #dcfce7;
}

.promotion-label {
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.modal-promotion.eligible .promotion-label {
  color: var(--success);
}

.promotion-bar-track {
  width: 100%;
  height: 14px;
  background: var(--gray-200);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.modal-promotion.eligible .promotion-bar-track {
  background: #bbf7d0;
}

.promotion-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 7px;
  transition: width 0.6s ease;
}

.modal-promotion.eligible .promotion-bar-fill {
  background: var(--success);
}

.promotion-count {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-600);
  font-weight: 500;
}

/* Loading Spinner */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* Offline Indicator */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  background: var(--warning);
  color: var(--white);
  text-align: center;
  font-weight: 600;
  display: none;
  z-index: 2000;
}

.offline-banner.show {
  display: block;
}

/* Class List */
.class-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.class-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.5rem;
  border: 3px solid var(--gray-200);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  gap: 0.25rem;
}

.class-card:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.class-card:active {
  transform: scale(0.98);
}

.class-card-name {
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 500;
  color: var(--gray-600);
  order: 2;
}

.class-card-time {
  font-size: var(--font-h3);
  line-height: var(--lh-h3);
  font-weight: 700;
  order: 1;
}

/* Class Status Variants */
.class-card--now {
  border-left: 5px solid var(--primary);
  background: rgba(37, 99, 235, 0.06);
  padding: 1.5rem 2rem;
}

.class-card--in_session {
  padding: 0.75rem 1rem;
  border-width: 2px;
}

.class-card--upcoming {
  padding: 0.75rem 1rem;
  border-width: 2px;
}

.class-card--upcoming .class-card-time {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
}

.class-card--upcoming .class-card-name {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.class-card--concluded {
  opacity: 0.4;
  border-color: var(--gray-100);
  padding: 0.75rem 1rem;
  border-width: 1px;
}

.class-card--concluded .class-card-time {
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 500;
}

.class-card--concluded .class-card-name {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

/* Class Card Badges */
.class-card-badge {
  display: inline-block;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 10px;
  order: 0;
}

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

.badge-current {
  background: var(--green, #16a34a);
  color: var(--white);
}

.badge-ended {
  background: var(--gray-200);
  color: var(--gray-600);
}

.more-classes-btn {
  width: 100%;
  padding: 1rem;
  margin-top: 0.5rem;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg, 12px);
  background: transparent;
  color: var(--gray-500);
  font-size: var(--font-body-1);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.more-classes-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

/* Back Button */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-300);
  border-radius: 12px;
  background: none;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-600);
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

.back-button:hover {
  border-color: var(--gray-600);
  color: var(--gray-800);
}

.back-button:active {
  transform: scale(0.98);
}

/* Selected Class Label */
.selected-class-label {
  text-align: center;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}

/* Confirm Modal Buttons */
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

.modal-btn {
  padding: 1rem;
  border: none;
  border-radius: 16px;
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

.modal-btn-confirm:hover {
  background: #15803d;
}

.modal-btn-cancel {
  background: var(--gray-200);
  color: var(--gray-800);
}

.modal-btn-cancel:hover {
  background: var(--gray-300);
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
  .kiosk-header h1 {
    font-size: var(--font-h5);
    line-height: var(--lh-h5);
  }

  .checkin-panel {
    padding: 1rem 1.5rem;
  }

  .class-card {
    padding: 1rem 1rem;
  }
}
