/* Parent Portal Styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ca8a04;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --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: var(--gray-50);
  color: var(--gray-800);
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 3rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  margin-bottom: 1rem;
}

.login-logo img {
  max-height: 64px;
  max-width: 200px;
  object-fit: contain;
}

.login-header h1 {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--gray-500);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.error-message {
  background: #fee2e2;
  color: var(--danger);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

/* Portal Layout */
.portal-container {
  min-height: 100vh;
}

.portal-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portal-school-logo {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--white);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.portal-school-logo:empty {
  display: none;
}

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

.portal-logo {
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 700;
  color: var(--gray-800);
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-user-name {
  font-weight: 500;
}

.btn-logout {
  padding: 0.5rem 1rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  background: var(--gray-100);
  color: var(--gray-700);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-logout:hover {
  background: var(--gray-200);
}

.portal-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Member Selector */
.member-selector {
  margin-bottom: 1.5rem;
}

.member-selector h2 {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}

.member-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.member-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.member-tab:hover {
  border-color: var(--primary);
}

.member-tab.active {
  border-color: var(--primary);
  background: #eff6ff;
}

.member-tab-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--gray-600);
}

.member-tab-info {
  text-align: left;
}

.member-tab-name {
  font-weight: 600;
}

.member-tab-rank {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.belt-swatch {
  display: inline-block;
  width: 24px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Dashboard Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-100);
}

.card-title {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Attendance List */
.attendance-list {
  list-style: none;
}

.attendance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.attendance-date {
  font-weight: 500;
}

.attendance-class {
  color: var(--gray-500);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.attendance-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  font-weight: 500;
  background: #dcfce7;
  color: var(--success);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}

/* Skills Progress */
.skill-category {
  margin-bottom: 1.5rem;
}

.skill-category:last-child {
  margin-bottom: 0;
}

.skill-category-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--gray-700);
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-badge {
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  background: var(--gray-100);
  color: var(--gray-600);
}

.skill-badge.completed {
  background: #dcfce7;
  color: var(--success);
}

.progress-bar-container {
  margin-top: 1.5rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

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

/* Payment Methods */
.payment-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.payment-method:last-child {
  margin-bottom: 0;
}

.card-icon {
  width: 48px;
  height: 32px;
  background: var(--gray-200);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-body-3);
  font-weight: 600;
}

.card-details {
  flex: 1;
}

.card-number {
  font-weight: 500;
}

.card-expiry {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-500);
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

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

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

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

.btn-danger:hover {
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

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

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

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

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

/* Portal Navigation */
.portal-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.5rem;
}

.portal-nav-item {
  padding: 0.75rem 1.5rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.2s;
}

.portal-nav-item:hover {
  color: var(--gray-700);
}

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

/* Billing Summary */
.billing-summary {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  border-radius: 12px;
  color: var(--white);
}

.billing-summary-amount,
.billing-summary-next {
  flex: 1;
}

.billing-summary-label {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.billing-summary-value {
  font-size: var(--font-h3);
  font-weight: 700;
}

.billing-summary-date {
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 600;
}

.billing-summary-next-amount {
  font-size: var(--font-h5);
  font-weight: 700;
  margin-top: 0.25rem;
}

/* Billing Past-Due States */
.billing-summary-past-due {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
}

.billing-summary-past-due-label {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  opacity: 0.9;
  margin-top: 0.25rem;
}

.past-due-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--danger);
  font-weight: 500;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.past-due-banner-icon {
  font-size: var(--font-h5);
  flex-shrink: 0;
}

.family-past-due-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.15s;
}

.family-past-due-notice:hover {
  background: #fee2e2;
}

.family-past-due-notice .notice-arrow {
  color: var(--danger);
  font-weight: 600;
  flex-shrink: 0;
}

.scheduled-payment-past-due {
  background: #fef2f2;
  border-radius: 6px;
  padding: 0.5rem;
  margin: 0 -0.5rem;
}

.enrollment-past-due-title {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 0.5rem;
}

.status-suspended {
  background: #fee2e2;
  color: var(--danger);
}

.status-past-due {
  background: #fee2e2;
  color: var(--danger);
  font-size: var(--font-body-4);
  padding: 0.25rem 0.5rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.status-late-fee {
  background: #fef3c7;
  color: #92400e;
  font-size: var(--font-body-4);
  padding: 0.25rem 0.5rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.enrollment-card-suspended {
  border-color: #fecaca;
  background: #fef2f2;
}

.enrollment-suspended-banner {
  background: #fee2e2;
  border-radius: 6px;
  padding: 0.75rem 0.75rem;
  margin-top: 0.75rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--danger);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger-outline:hover {
  background: #fef2f2;
}

/* Billing Grid */
.billing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Enrollment Cards */
.enrollment-card {
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.enrollment-card:last-child {
  margin-bottom: 0;
}

.enrollment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.enrollment-member {
  font-weight: 600;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.enrollment-package {
  color: var(--gray-500);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.enrollment-progress {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}

.enrollment-upcoming {
  border-top: 1px solid var(--gray-100);
  padding-top: 0.75rem;
}

.enrollment-upcoming-title {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

/* Scheduled Payments */
.scheduled-payment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.scheduled-payment:last-child {
  border-bottom: none;
}

.scheduled-payment-info {
  display: flex;
  gap: 1rem;
}

.scheduled-payment-date {
  color: var(--gray-600);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.scheduled-payment-amount {
  font-weight: 600;
}

/* Payment History Table */
.payment-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.payment-history-table th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--gray-200);
}

.payment-history-table td {
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}

.payment-history-table tbody tr:hover {
  background: var(--gray-50);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  font-weight: 500;
  text-transform: capitalize;
}

.status-completed {
  background: #dcfce7;
  color: var(--success);
}

.status-pending {
  background: #fef9c3;
  color: var(--warning);
}

.status-failed {
  background: #fee2e2;
  color: var(--danger);
}

.status-info {
  background: #dbeafe;
  color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-content {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-100);
}

.modal-title {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-h4);
  color: var(--gray-500);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gray-700);
}

.modal-body {
  padding: 1.5rem;
}

/* Stripe Elements */
#card-element {
  padding: 0.75rem;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  transition: border-color 0.2s;
}

#card-element.StripeElement--focus {
  border-color: var(--primary);
}

/* Account View */
.account-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.account-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.account-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.account-info-row:last-child {
  border-bottom: none;
}

.account-info-label {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-500);
  flex-shrink: 0;
  min-width: 140px;
}

.account-info-value {
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.account-staff-note {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  color: var(--gray-400);
  margin-top: 0.75rem;
}

.account-emergency-card {
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.account-emergency-card:last-child {
  margin-bottom: 0;
}

.account-emergency-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.account-emergency-name {
  font-weight: 600;
}

.account-form-row {
  display: flex;
  gap: 0.75rem;
}

/* Member Photos */
.member-profile-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.photo-upload-actions {
  display: flex;
  gap: 0.5rem;
}

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

/* Responsive */
@media (max-width: 767.98px) {
  .portal-header {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .member-tabs {
    flex-direction: column;
  }

  .member-tab {
    width: 100%;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .billing-summary {
    flex-direction: column;
  }

  .payment-history-table {
    display: block;
    overflow-x: auto;
  }

  .scheduled-payment {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .account-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .account-info-value {
    text-align: left;
  }

  .account-form-row {
    flex-direction: column;
    gap: 0;
  }

  .photo-upload-actions {
    flex-direction: column;
  }
}
