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

body {
  font-family: "Arial", sans-serif;
  /* background: linear-gradient(135deg, #ebbd18 0%, #dac911 100%); */
  min-height: 100vh;
  /* padding: 20px; */
  scroll-behavior: smooth;
}

.header {
  background-color: black;
  padding: 1rem;
  text-align: center;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-title h1 {
  font-family: "Lexend Deca", sans-serif;
  font-optical-sizing: auto;
  font-weight: 300;
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.sub-header {
  font-family: "Lexend Deca", sans-serif;
  font-optical-sizing: auto;
  font-size: 1.2rem;
}

/* Search Container Styles */
.search-container {
  padding: 2rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  gap: 1rem;
  will-change: transform, height, padding;
  transform: translateZ(0);
  position: relative;
  overflow: hidden;
}

/* Google-like centered search when in search-only mode */
.search-container.search-only {
  height: calc(91vh);
  padding: 0 2rem;
  justify-content: center;
}

/* Browse mode - shrink to top like scroll animation */
.search-container:not(.search-only) {
  height: 200px; /* Compact height at top */
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  transform: translateY(0) translateZ(0);
}

/* Search box transitions - smooth center to top movement */
.search-container.search-only .search-box {
  max-width: 600px;
  width: 100%;
  transform: scale(1.1) translateZ(0);
  transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  margin-top: 0; /* Center position */
}

/* Browse mode - compact search box with smooth transition to top */
.search-container:not(.search-only) .search-box {
  max-width: 500px;
  transform: scale(0.9) translateZ(0);
  transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  margin-top: 0; /* Top position */
}

/* Toggle container transitions - smooth center to top movement */
.search-container.search-only .toggle-container {
  opacity: 0.8;
  transform: scale(0.9) translateZ(0);
  transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform, opacity;
  margin-top: 1.5rem; /* Center position */
}

/* Browse mode - normal toggle size with smooth transition to top */
.search-container:not(.search-only) .toggle-container {
  opacity: 1;
  transform: scale(1) translateZ(0);
  transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform, opacity;
  margin-top: 0.5rem; /* Top position */
}

/* Professional Toggle Switch Styles */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
  padding: 0.8rem 1.2rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow, background;
  transform: translateZ(0);
}

.toggle-container:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px) translateZ(0);
}

.toggle-label {
  font-family: "Lexend Deca", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: color;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 28px;
  border: 2px solid #d1d5db;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  will-change: background, border-color, box-shadow;
  transform: translateZ(0);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 2px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  will-change: transform, background, box-shadow;
  transform: translateZ(0);
}

input:checked + .toggle-slider {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: #3b82f6;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input:checked + .toggle-slider:before {
  transform: translateX(28px) translateZ(0);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input:checked ~ .toggle-label {
  color: #1d4ed8;
  font-weight: 600;
}

.search-box {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 50px;
  padding: 0.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 500px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 3px solid #3b82f6;
  will-change: transform, box-shadow, border-color;
  transform: translateZ(0);
}

/* Dynamic border colors */
.search-box.typing {
  border-color: #10b981;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

.search-box.typing:focus-within {
  border-color: #10b981;
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.3);
}

.search-box.not-found {
  border-color: #ef4444;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

.search-box.not-found:focus-within {
  border-color: #ef4444;
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.3);
}

.search-box:focus-within {
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px) translateZ(0);
}

#searchInput {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: "Lexend Deca", sans-serif;
  background: transparent;
}

#searchInput::placeholder {
  color: #999;
  font-style: italic;
}

#searchBtn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: white;
  will-change: transform, box-shadow;
  transform: translateZ(0);
}

#searchBtn:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Results Container Styles */
.results-container {
  padding: 3rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  opacity: 1;
  transform: translateY(0) translateZ(0);
  will-change: opacity, transform;
  background: white;
  min-height: calc(100vh - 400px); /* Full height minus header and search container */
}

.results-container.hidden {
  display: none;
  opacity: 0;
  transform: translateY(50px) translateZ(0);
}

/* Course Card Styles */
.course-card {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 5px solid #667eea;
  opacity: 1;
  transform: translateY(0) translateZ(0);
  will-change: transform, box-shadow;
}

.course-card:hover {
  transform: translateY(-5px) translateZ(0);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

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

.course-code {
  font-family: "Lexend Deca", sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: #667eea;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.credit-hours {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.course-title {
  font-family: "Lexend Deca", sans-serif;
  font-weight: 500;
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.course-details {
  margin-bottom: 1rem;
}

.detail-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.detail-label {
  font-weight: 600;
  color: #667eea;
  min-width: 100px;
  margin-right: 0.5rem;
  font-size: 0.9rem;
}

.detail-value {
  color: #555;
  flex: 1;
  line-height: 1.5;
  font-size: 0.9rem;
}

.prerequisite {
  background: #f8f9fa;
  padding: 0.5rem;
  border-radius: 8px;
  border-left: 3px solid #28a745;
}

.no-prerequisite {
  background: #f8f9fa;
  padding: 0.5rem;
  border-radius: 8px;
  border-left: 3px solid #6c757d;
  color: #6c757d;
  font-style: italic;
}

.description {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  line-height: 1.6;
  font-size: 0.9rem;
  color: #555;
  max-height: 150px;
  overflow-y: auto;
  text-align: justify;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #666;
  font-family: "Lexend Deca", sans-serif;
  font-size: 1.2rem;
}

.no-results svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .results-container {
    max-width: 100%;
    padding: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 912px) {
  .main-title h1 {
    font-size: 2.5rem;
  }
  
  .search-container {
    padding: 1.5rem;
  }
  
  .search-container.search-only {
    height: calc(95vh);
  }

  .search-container:not(.search-only) {
    height: 180px;
    padding: 1rem 1.5rem;
  }
  
  .search-box {
    max-width: 450px;
  }
  
  .results-container {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.2rem;
    padding: 1.2rem;
  }
}

@media (max-width: 740px) {
  .main-title h1 {
    font-size: 2rem;
  }
  
  .sub-header {
    font-size: 1rem;
  }
  
  .search-container {
    padding: 1rem;
  }
  
  .search-container:not(.search-only) {
    height: 150px;
    padding: 1rem;
  }
  
  .search-box {
    max-width: 100%;
  }
  
  .toggle-container {
    padding: 0.6rem 1rem;
    gap: 0.6rem;
  }
  
  .toggle-label {
    font-size: 0.8rem;
  }
  
  .results-container {
    padding: 1rem;
    grid-template-columns: 1fr;
    gap: 1rem;
    min-height: calc(100vh - 350px);
  }
  
  .course-card {
    padding: 1rem;
  }
  
  .course-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .course-code {
    font-size: 1.1rem;
  }
  
  .course-title {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .main-title h1 {
    font-size: 1.8rem;
  }
  
  .search-container {
    padding: 0.8rem;
  }

  .search-container.search-only {
    height: calc(92vh);
  }

  .search-container:not(.search-only) {
    height: 155px;
    padding: 0.8rem;
  }
  
  .search-box {
    padding: 0.4rem;
  }
  
  #searchInput {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }
  
  #searchBtn {
    width: 40px;
    height: 40px;
  }
  
  .toggle-container {
    padding: 0.5rem 0.8rem;
    gap: 0.5rem;
  }
  
  .toggle-label {
    font-size: 0.75rem;
  }
  
  .toggle-switch {
    width: 48px;
    height: 24px;
  }
  
  .toggle-slider:before {
    height: 16px;
    width: 16px;
  }
  
  input:checked + .toggle-slider:before {
    transform: translateX(24px) translateZ(0);
  }
  
  .results-container {
    padding: 0.8rem;
    min-height: calc(100vh - 300px);
  }
  
  .course-card {
    padding: 0.8rem;
  }
  
  .detail-label {
    min-width: 80px;
    font-size: 0.8rem;
  }
  
  .detail-value {
    font-size: 0.8rem;
  }
}