/* Custom styles for SPP Management */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--foreground);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Dark mode body styles */
.dark body,
html.dark body {
  background: var(--background);
  color: var(--foreground);
}

* {
  box-sizing: border-box;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Table styles */
table {
  border-collapse: collapse;
}

/* Button hover effects */
button:hover,
a.btn:hover {
  opacity: 0.9;
}

/* Form elements */
input,
select,
textarea {
  font-family: inherit;
}

/* ============================================
   MOBILE-FIRST RESPONSIVE STYLES
   Target: 412 x 915 display (Pixel 7)
   ============================================ */

/* Navigation Styles */
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-foreground);
  text-decoration: none;
}

.nav-links {
  display: none;
  gap: 0.5rem;
}

.nav-link {
  color: var(--primary-foreground);
  opacity: 0.8;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: var(--primary-foreground);
  opacity: 1;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-user {
  display: none;
  align-items: center;
  gap: 1rem;
}

.nav-user-info {
  font-size: 0.875rem;
  text-align: right;
}

.nav-user-name {
  font-weight: 500;
}

.nav-user-email {
  font-size: 0.75rem;
  opacity: 0.8;
}

.nav-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
}

.nav-avatar-placeholder {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--primary-foreground);
  border-radius: 1px;
}

/* Mobile Menu Overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary);
  padding: 1rem;
  z-index: 100;
  flex-direction: column;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu-link {
  display: block;
  color: var(--primary-foreground);
  padding: 1rem;
  text-decoration: none;
  font-size: 1.125rem;
  font-weight: 500;
  border-radius: 0.5rem;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
  background: rgba(255,255,255,0.1);
}

.mobile-menu-divider {
  border-top: 1px solid rgba(255,255,255,0.2);
  margin: 1rem 0;
}

.mobile-menu-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  color: var(--primary-foreground);
}

/* Page Layout */
.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--foreground);
}

.page-subtitle {
  color: var(--muted-foreground);
  margin: 0;
  font-size: 0.875rem;
}

/* Cards */
.card {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-card {
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
}

.summary-card-blue {
  background: var(--chart-3);
}

.summary-card-pink {
  background: var(--secondary);
}

.summary-card-green {
  background: var(--chart-1);
}

.summary-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.summary-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}

/* Data Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background: var(--muted);
}

/* Mobile Data Cards */
.mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-data-card {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: var(--card);
}

.mobile-card-header {
  font-weight: 600;
  font-size: 0.875rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
}

.mobile-card-row {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  font-size: 0.875rem;
}

.mobile-card-label {
  color: var(--muted-foreground);
}

.mobile-card-value {
  font-weight: 500;
}

.mobile-card-total {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  font-weight: 600;
}

.mobile-card-total .mobile-card-label,
.mobile-card-total .mobile-card-value {
  font-weight: 600;
  color: var(--foreground);
}

/* Form Styles */
.form-container {
  max-width: 100%;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--foreground);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--card);
}

.form-textarea {
  height: auto;
  min-height: 6rem;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--muted);
}

.btn-success {
  background: var(--chart-1);
  color: var(--primary-foreground);
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-success {
  background: #3b82f6;
  color: #ffffff;
}

.badge-danger {
  background: #f97316;
  color: #ffffff;
}

.badge-blue {
  background: var(--primary);
  color: var(--primary-foreground);
}

.badge-gray {
  background: var(--muted);
  color: var(--muted-foreground);
}

/* Student Name Link */
.student-name-link {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.student-name-link:hover {
  text-decoration: underline;
}

/* Action Buttons Group */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.action-buttons .btn {
  width: auto;
  flex: 1 1 auto;
  min-width: 120px;
}

/* Student Info Card */
.student-info-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.student-info-section {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.student-info-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-row {
  display: flex;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.info-label {
  color: var(--muted-foreground);
  min-width: 100px;
  flex-shrink: 0;
}

.info-value {
  font-weight: 500;
}

/* Financial Summary */
.financial-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}

.financial-card {
  padding: 0.75rem;
  border-radius: 0.375rem;
  text-align: center;
  border: 1px solid var(--border);
}

.financial-card-label {
  font-size: 0.625rem;
  color: var(--foreground);
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.financial-card-value {
  font-size: 0.875rem;
  font-weight: 600;
}

/* Financial card color variants with dark mode support */
.financial-card-blue {
  background: #dbeafe;
  color: #1e40af;
}
.dark .financial-card-blue {
  background: #1e3a5f;
  color: #93c5fd;
}
.financial-card-blue .financial-card-label {
  color: #1e40af;
}
.dark .financial-card-blue .financial-card-label {
  color: #93c5fd;
}

.financial-card-amber {
  background: #fef3c7;
  color: #92400e;
}
.dark .financial-card-amber {
  background: #451a03;
  color: #fcd34d;
}
.financial-card-amber .financial-card-label {
  color: #92400e;
}
.dark .financial-card-amber .financial-card-label {
  color: #fcd34d;
}

.financial-card-green {
  background: #dcfce7;
  color: #166534;
}
.dark .financial-card-green {
  background: #14532d;
  color: #86efac;
}
.financial-card-green .financial-card-label {
  color: #166534;
}
.dark .financial-card-green .financial-card-label {
  color: #86efac;
}

.financial-card-red {
  background: #fee2e2;
  color: #991b1b;
}
.dark .financial-card-red {
  background: #450a0a;
  color: #fca5a5;
}
.financial-card-red .financial-card-label {
  color: #991b1b;
}
.dark .financial-card-red .financial-card-label {
  color: #fca5a5;
}

.financial-card-neutral {
  background: #f3f4f6;
  color: #374151;
}
.dark .financial-card-neutral {
  background: #374151;
  color: #d1d5db;
}
.financial-card-neutral .financial-card-label {
  color: #374151;
}
.dark .financial-card-neutral .financial-card-label {
  color: #d1d5db;
}

/* Search Input */
.search-container {
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--card);
}

/* Back Link */
.back-link {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.back-link:hover {
  color: var(--foreground);
}

/* Desktop/Mobile Visibility */
.desktop-only {
  display: none;
}

.mobile-only {
  display: block;
}

/* ============================================
   TABLET & DESKTOP STYLES (768px+)
   ============================================ */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
  
  .nav-user {
    display: flex;
  }
  
  .mobile-menu-btn {
    display: none;
  }
  
  .page-title {
    font-size: 1.875rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .summary-value {
    font-size: 1.25rem;
  }
  
  .form-actions {
    flex-direction: row;
    justify-content: flex-start;
  }
  
  .btn {
    width: auto;
  }
  
  .action-buttons .btn {
    flex: none;
    min-width: auto;
  }
  
  .student-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  
  .student-info-section {
    border-bottom: none;
    padding-bottom: 0;
  }
  
  .financial-summary {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .financial-card-label {
    font-size: 0.75rem;
  }
  
  .financial-card-value {
    font-size: 1rem;
  }
  
  .desktop-only {
    display: block;
  }
  
  .mobile-only {
    display: none;
  }
  
  .search-input {
    max-width: 28rem;
  }
}

/* Large Desktop (1024px+) */
@media (min-width: 1024px) {
  main.container {
    padding: 2rem;
  }
}

/* ============================================
   THEME TOGGLE BUTTON STYLES
   ============================================ */

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.theme-toggle-btn:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

.theme-icon {
  color: var(--primary-foreground);
}

/* ============================================
   DARK MODE STYLES
   ============================================ */

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
}

.login-container {
  width: 100%;
  max-width: 28rem;
  padding: 1rem;
}

.login-card {
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 2rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.login-subtitle {
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

.login-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.375rem;
  background: var(--primary);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary-foreground);
  text-decoration: none;
  transition: background-color 0.2s;
}

.login-button:hover {
  opacity: 0.9;
}

/* Dark mode login page - no longer needed as variables handle it */

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  z-index: 1000;
}

.back-to-top:hover {
  opacity: 0.9;
  transform: translateY(0) scale(1.05);
}

.back-to-top:active {
  transform: translateY(0) scale(0.95);
}

.back-to-top.visible {
  opacity: 0.7;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Mobile adjustments for back to top button */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 2.75rem;
    height: 2.75rem;
  }
  
  .back-to-top svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}
