/* ==================== CSS VARIABLES ==================== */
:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-primary: #0f172a;
  --color-primary-hover: #1e293b;
  --color-success: #10b981;
  --color-success-bg: #d1fae5;
  --color-error: #dc2626;
  --color-error-bg: #fee2e2;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --transition: all 0.2s ease;
}

/* ==================== RESET ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

/* Focus Styles for Accessibility */
*:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ==================== UTILITIES ==================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* ==================== LAYOUT ==================== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ==================== HEADER ==================== */
.header {
  text-align: center;
  margin-bottom: 3rem;
}

.logo {
  display: inline-flex;
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.6s ease;
}

.header h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
  animation: fadeInDown 0.6s ease 0.1s both;
}

.header p {
  font-size: 1rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
  animation: fadeInDown 0.6s ease 0.2s both;
}

/* ==================== SEARCH SECTION ==================== */
.search-section {
  margin-bottom: 2.5rem;
  animation: fadeInUp 0.6s ease 0.3s both;
}

.search-box {
  padding: 1.5rem;
  display: flex;
  gap: 0.75rem;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--color-primary);
}

.search-box input {
  flex: 1;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  transition: var(--transition);
  background: var(--color-bg);
}

.search-box input:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.search-box input::placeholder {
  color: var(--color-text-muted);
}

.search-box button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: white;
  background: var(--color-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.search-box button:hover:not(:disabled) {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.search-box button:active:not(:disabled) {
  transform: translateY(0);
}

.search-box button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.search-box button svg {
  width: 18px;
  height: 18px;
}

/* ==================== RESULTS SECTION ==================== */
.results-section {
  min-height: 300px;
}

/* Loading State */
.loading-card {
  display: none;
  padding: 2rem;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.skeleton-badge {
  width: 100px;
  height: 24px;
  margin-bottom: 1rem;
}

.skeleton-title {
  width: 60%;
  height: 32px;
  margin-bottom: 1.5rem;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.skeleton-field {
  height: 80px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Result Card */
.result-card {
  display: none;
  padding: 2rem;
  animation: fadeInUp 0.4s ease;
}

.card-header {
  margin-bottom: 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 999px;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.student-name {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.info-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  transition: var(--transition);
}

.info-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.info-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-value {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
}

/* Error Card */
.error-card {
  display: none;
  padding: 3rem 2rem;
  text-align: center;
  animation: fadeInUp 0.4s ease;
}

.error-card svg {
  margin-bottom: 1.5rem;
}

.error-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-error);
}

.error-card p {
  color: var(--color-text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ==================== FOOTER ==================== */
.footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.footer nav {
  margin-top: 0.5rem;
}

.footer nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: var(--transition);
}

.footer nav a:hover {
  color: var(--color-primary);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .header {
    margin-bottom: 2rem;
  }

  .logo {
    margin-bottom: 1rem;
  }

  .search-box {
    flex-direction: column;
    padding: 1.25rem;
  }

  .search-box button {
    width: 100%;
    justify-content: center;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .result-card,
  .error-card {
    padding: 1.5rem;
  }

  .skeleton-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1rem 0.75rem;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .header p {
    font-size: 0.875rem;
  }

  .student-name {
    font-size: 1.25rem;
  }

  .search-box input {
    font-size: 0.875rem;
  }

  .search-box button {
    font-size: 0.875rem;
    padding: 0.75rem 1.25rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 3rem 2rem;
  }

  .header {
    margin-bottom: 3.5rem;
  }
}

/* ==================== PRINT STYLES ==================== */
@media print {
  body {
    background: white;
  }

  .search-section,
  .footer,
  .skip-link {
    display: none;
  }

  .result-card {
    box-shadow: none;
    border: 2px solid var(--color-border);
  }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==================== HIGH CONTRAST MODE ==================== */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --color-text-muted: #1e293b;
  }
}

/* ==================== DARK MODE SUPPORT ==================== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-border: #334155;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
  }

  .info-item {
    background: #0f172a;
  }

  .search-box input {
    background: #0f172a;
  }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 1px;
}

::-webkit-scrollbar-track {
  background: transparent;
}