// Apple-inspired Minimalist Design System
// =========================================

:root {
  // Colors - Light Theme
  --bg-primary: #F5F5F7;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F2F2F7;

  --text-primary: #1D1D1F;
  --text-secondary: #86868B;
  --text-tertiary: #AEAEB2;

  --accent: #007AFF;
  --accent-hover: #0066D6;
  --success: #34C759;
  --warning: #FF9500;
  --error: #FF3B30;

  --border-light: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.12);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition: 0.2s ease;
}

// Reset & Base
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

// Typography
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

// Card Component
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: box-shadow var(--transition);

  &:hover {
    box-shadow: var(--shadow-md);
  }

  &-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
  }

  &-body {
    padding: 1.5rem;
  }
}

// Buttons
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;

  &-primary {
    background: var(--accent);
    color: white;

    &:hover {
      background: var(--accent-hover);
    }
  }

  &-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);

    &:hover {
      background: var(--border-medium);
    }
  }

  &-ghost {
    background: transparent;
    color: var(--accent);

    &:hover {
      background: rgba(0, 122, 255, 0.08);
    }
  }

  &-danger {
    background: rgba(255, 59, 48, 0.1);
    color: var(--error);

    &:hover {
      background: rgba(255, 59, 48, 0.15);
    }
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  &-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }

  &-icon {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
  }
}

// Form Elements
.form-group {
  margin-bottom: 1.5rem;

  label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
  }
}

.input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition);

  &:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
  }

  &::placeholder {
    color: var(--text-tertiary);
  }

  &.error {
    border-color: var(--error);

    &:focus {
      box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.15);
    }
  }
}

.error-message {
  color: var(--error);
  font-size: 0.8125rem;
  margin-top: 0.5rem;
}

// Page Header
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;

  h1 {
    font-size: 1.75rem;
  }
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}

// Back Link
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  transition: opacity var(--transition);

  &:hover {
    opacity: 0.8;
  }

  mat-icon {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
  }
}

// Table
.data-table {
  width: 100%;
  border-collapse: collapse;

  th, td {
    padding: 1rem 1.25rem;
    text-align: left;
  }

  th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
  }

  td {
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9375rem;
  }

  tr:last-child td {
    border-bottom: none;
  }

  tr:hover td {
    background: var(--bg-tertiary);
  }
}

// Badge
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;

  &-info {
    background: rgba(0, 122, 255, 0.1);
    color: var(--accent);
  }

  &-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
  }

  &-warning {
    background: rgba(255, 149, 0, 0.1);
    color: var(--warning);
  }

  &-error {
    background: rgba(255, 59, 48, 0.1);
    color: var(--error);
  }
}

// Progress Bar
.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 100px;
  overflow: hidden;

  &-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #5856D6 100%);
    border-radius: 100px;
    transition: width 0.3s ease;
  }
}

// Empty State
.empty-state {
  text-align: center;
  padding: 4rem 2rem;

  &-icon {
    font-size: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
  }

  &-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
  }

  &-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
  }
}

// Loading Skeleton
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

// Toast Notification
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 1.5rem;
  background: var(--text-primary);
  color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: toast-in 0.3s ease;

  &-success { background: var(--success); }
  &-error { background: var(--error); }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 1rem);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

// Actions Group
.actions {
  display: flex;
  gap: 0.5rem;
}

// Subject Card (for enrollment)
.subject-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition);

  &:hover {
    border-color: var(--border-medium);
  }

  &.enrolled {
    border-color: var(--success);
    background: rgba(52, 199, 89, 0.05);
  }

  &.unavailable {
    opacity: 0.6;
  }

  &-info {
    flex: 1;
  }

  &-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
  }

  &-professor {
    font-size: 0.875rem;
    color: var(--text-secondary);
  }

  &-credits {
    font-size: 0.75rem;
    color: var(--text-tertiary);
  }
}

// Classmates List
.classmates-section {
  margin-bottom: 2rem;

  &-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
  }
}

.classmate-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;

  &-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
  }

  &-name {
    font-size: 0.9375rem;
  }
}

// Angular Material Overrides
.mat-mdc-snack-bar-container {
  &.success-snackbar {
    --mdc-snackbar-container-color: var(--success);
  }
  &.error-snackbar {
    --mdc-snackbar-container-color: var(--error);
  }
}

.mat-mdc-dialog-container {
  --mdc-dialog-container-shape: var(--radius-lg);
}

.mat-mdc-form-field {
  width: 100%;
}

// Responsive
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

@media (max-width: 600px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .card {
    border-radius: var(--radius-md);

    &-header, &-body {
      padding: 1rem;
    }
  }
}
