@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
  color: #333;
  overflow-x: hidden;
  background: #f8f9fa;
  max-width: 100vw;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

:root {
  --primary-color: #FFC107;
  --primary-dark: #FF8F00;
  --primary-light: #FFF9C4;
  --accent-color: #795548;
  --dark-color: #212121;
  --light-color: #f8f9fa;
  --white: #ffffff;
  --gray: #757575;
  --gradient-1: linear-gradient(135deg, #FFC107 0%, #FF8F00 100%);
  --gradient-2: linear-gradient(135deg, #FF8F00 0%, #FFC107 100%);
  --shadow-light: 0 8px 25px rgba(255, 193, 7, 0.15);
  --shadow-medium: 0 15px 35px rgba(255, 193, 7, 0.2);
  --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Animated Background */
.bg-animated {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  overflow: hidden;
}

.shapes-floating {
  position: absolute;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  opacity: 0.1;
  animation: float 20s infinite linear;
}

.shape-1 {
  top: 10%;
  left: 10%;
  width: 60px;
  height: 60px;
  background: var(--gradient-1);
  border-radius: 50%;
  animation-delay: 0s;
}

.shape-2 {
  top: 70%;
  left: 80%;
  width: 40px;
  height: 40px;
  background: var(--gradient-2);
  border-radius: 50%;
  animation-delay: -5s;
}

.shape-3 {
  top: 20%;
  left: 60%;
  width: 80px;
  height: 80px;
  background: var(--primary-color);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  animation-delay: -10s;
}

.shape-4 {
  top: 60%;
  left: 20%;
  width: 50px;
  height: 50px;
  background: var(--primary-dark);
  border-radius: 10px;
  animation-delay: -15s;
}

.shape-5 {
  top: 40%;
  left: 90%;
  width: 30px;
  height: 30px;
  background: var(--gradient-1);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation-delay: -7s;
}

.shape-6 {
  top: 80%;
  left: 50%;
  width: 70px;
  height: 70px;
  background: var(--gradient-2);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  animation-delay: -12s;
}

.grid-tech {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(90deg, transparent 24%, rgba(255, 193, 7, 0.03) 25%, rgba(255, 193, 7, 0.03) 26%, transparent 27%, transparent 74%, rgba(255, 193, 7, 0.03) 75%, rgba(255, 193, 7, 0.03) 76%, transparent 77%, transparent),
    linear-gradient(0deg, transparent 24%, rgba(255, 193, 7, 0.03) 25%, rgba(255, 193, 7, 0.03) 26%, transparent 27%, transparent 74%, rgba(255, 193, 7, 0.03) 75%, rgba(255, 193, 7, 0.03) 76%, transparent 77%, transparent);
  background-size: 50px 50px;
}

/* Navigation Bar */
.header-nav {
  background: rgba(255, 255, 255);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-light);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

.header-nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
}

.brand {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-dark);
  text-decoration: none;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand:hover {
  transform: scale(0.918);
  color: var(--primary-color);
}

.brand__image {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  transition: all 0.3s ease;
  transform: scale(4.18);
  margin-left: 1.5em;
}

.nav__links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav__links a {
  text-decoration: none;
  color: var(--dark-color);
  font-weight: 500;
  position: relative;
  padding: 8px 0;
  transition: all 0.3s ease;
  font-size: 14px;
}

.nav__links a:hover {
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.nav__links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 3px;
  background: var(--gradient-1);
  bottom: 0;
  left: 0;
  transition: width 0.3s ease;
  border-radius: 2px;
}

.nav__links a:hover::after {
  width: 100%;
}

.nav__toggle {
  display: none;
  cursor: pointer;
  padding: 5px;
  z-index: 1002;
}

.nav__toggle-line {
  width: 25px;
  height: 3px;
  background: var(--gradient-1);
  margin: 5px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

/* Main Content */
.content-main {
  padding: 130px 0 60px;
  min-height: 100vh;
}

/* Page Header */
.section-header {
  text-align: center;
  margin-bottom: 50px;
  animation: fadeInUp 1s ease;
}

.section-title {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 15px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--gradient-1);
  border-radius: 2px;
}

.section-subtitle {
  font-size: 1.2rem;
  color: var(--gray);
  font-weight: 500;
  animation: fadeInUp 1s ease 0.2s both;
}

/* Search */
.search {
  max-width: 600px;
  margin: 0 auto 50px;
  animation: fadeInUp 1s ease 0.4s both;
}

.search__box {
  position: relative;
  background: var(--white);
  border-radius: 50px;
  box-shadow: var(--shadow-light);
  border: 2px solid transparent;
  transition: all 0.3s ease;
  overflow: hidden;
}

.search__box:hover {
  box-shadow: var(--shadow-medium);
  border-color: var(--primary-light);
}

.search__box:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.2);
}

.search__icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 18px;
  z-index: 2;
  transition: all 0.3s ease;
}

.search__box:focus-within .search__icon {
  color: var(--primary-dark);
  transform: translateY(-50%) scale(1.1);
}

.search__input {
  width: 100%;
  padding: 18px 60px 18px 55px;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
  background: transparent;
  color: var(--dark-color);
  font-weight: 500;
}

.search__input::placeholder {
  color: var(--gray);
  font-weight: 400;
}

.search__clear {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gradient-1);
  color: var(--white);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  font-size: 12px;
}

.search__clear.active {
  opacity: 1;
  visibility: visible;
}

.search__clear:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: var(--shadow-light);
}

.search__count {
  text-align: center;
  margin-top: 15px;
  color: var(--gray);
  font-size: 14px;
  font-weight: 500;
  opacity: 0.8;
}

/* Subjects Grid */
.subjects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  animation: fadeInUp 1s ease 0.6s both;
}

.subject__card {
  background: var(--white);
  border-radius: 20px;
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-light);
  transition: all 0.4s ease;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.5s ease forwards;
}

.subject__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-1);
  opacity: 0.05;
  transition: left 0.4s ease;
  z-index: 1;
}

.subject__card:hover::before {
  left: 0;
}

.subject__card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-heavy);
  border-color: var(--primary-color);
}

.subject__icon {
  width: 80px;
  height: 80px;
  background: var(--gradient-1);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--white);
  transition: all 0.4s ease;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.subject__card:hover .subject__icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--shadow-medium);
}

.subject__info {
  flex: 1;
  position: relative;
  z-index: 2;
}

.subject__name {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.subject__card:hover .subject__name {
  transform: translateX(5px);
}

.subject__desc {
  color: var(--gray);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: all 0.3s ease;
}

.subject__card:hover .subject__desc {
  color: var(--dark-color);
  transform: translateX(5px);
}

.subject__arrow {
  font-size: 1.2rem;
  color: var(--gray);
  transition: all 0.4s ease;
  position: relative;
  z-index: 2;
}

.subject__card:hover .subject__arrow {
  color: var(--primary-dark);
  transform: translateX(10px) scale(1.2);
}

.subject__link {
  display: contents;
  text-decoration: none;
  color: inherit;
}

/* No Results */
.results-empty {
  text-align: center;
  padding: 80px 20px;
  animation: fadeInUp 0.5s ease;
}

.results-empty__inner {
  max-width: 400px;
  margin: 0 auto;
}

.results-empty__inner i {
  font-size: 4rem;
  color: var(--primary-light);
  margin-bottom: 30px;
}

.results-empty__inner h3 {
  font-size: 1.8rem;
  color: var(--primary-dark);
  margin-bottom: 15px;
  font-weight: 600;
}

.results-empty__inner p {
  color: var(--gray);
  font-size: 1.1rem;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: var(--gradient-1);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-light);
  transition: all 0.4s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: var(--shadow-medium);
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-20px) rotate(120deg); }
  66% { transform: translateY(20px) rotate(240deg); }
  100% { transform: translateY(0px) rotate(360deg); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); transform: scale(1); }
  70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); transform: scale(1); }
}

/* Loading Animation */
.subject__card {
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.5s ease forwards;
}

@keyframes cardFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Stagger animation for cards */
.subject__card:nth-child(1) { animation-delay: 0.1s; }
.subject__card:nth-child(2) { animation-delay: 0.2s; }
.subject__card:nth-child(3) { animation-delay: 0.3s; }
.subject__card:nth-child(4) { animation-delay: 0.4s; }
.subject__card:nth-child(5) { animation-delay: 0.5s; }
.subject__card:nth-child(6) { animation-delay: 0.6s; }
.subject__card:nth-child(7) { animation-delay: 0.7s; }
.subject__card:nth-child(8) { animation-delay: 0.8s; }
.subject__card:nth-child(9) { animation-delay: 0.9s; }
.subject__card:nth-child(10) { animation-delay: 1.0s; }
.subject__card:nth-child(11) { animation-delay: 1.1s; }
.subject__card:nth-child(12) { animation-delay: 1.2s; }

/* Responsive Design */
@media (max-width: 1024px) {
  .subjects {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
  }

  .subject__card {
    padding: 20px;
  }

  .subject__icon {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
  }
}

@media (max-width: 768px) {
  .nav__links {
    position: fixed;
    top: 90px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 90px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 50px;
    transition: all 0.5s ease;
    z-index: 999;
    gap: 0;
  }

  .nav__links.active { left: 0; }

  .nav__links a {
    font-size: 18px;
    margin: 15px 0;
    padding: 15px 20px;
    width: 90%;
    text-align: center;
    border-radius: 10px;
    transition: all 0.3s ease;
  }

  .nav__links a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(0);
  }

  .nav__toggle { display: block; }

  .nav__toggle.active .nav__toggle-line:nth-child(1) { transform: rotate(45deg) translate(8px, 8px); }
  .nav__toggle.active .nav__toggle-line:nth-child(2) { opacity: 0; }
  .nav__toggle.active .nav__toggle-line:nth-child(3) { transform: rotate(-45deg) translate(8px, -8px); }

  .content-main { padding: 120px 0 60px; }

  .section-title { font-size: 2.5rem; margin-bottom: 10px; }
  .section-subtitle { font-size: 1.1rem; }
  .search { margin-bottom: 40px; }

  .search__input { font-size: 16px; padding: 16px 55px 16px 50px; }
  .search__icon { font-size: 16px; left: 18px; }
  .search__clear { right: 18px; width: 28px; height: 28px; }

  .subjects { grid-template-columns: 1fr; gap: 15px; }
  .subject__card { padding: 20px; gap: 15px; }
  .subject__icon { width: 65px; height: 65px; font-size: 1.6rem; border-radius: 15px; }
  .subject__name { font-size: 1.3rem; }
  .subject__desc { font-size: 0.9rem; }

  .back-to-top { width: 55px; height: 55px; bottom: 25px; right: 25px; font-size: 1.3rem; }
}

@media (max-width: 480px) {
  .container { width: 95%; padding: 0 10px; }
  .header-nav .container { padding: 15px 15px; }
  .brand { font-size: 24px; }

  .content-main { padding: 110px 0 40px; }
  .section-header { margin-bottom: 35px; }
  .section-title { font-size: 2rem; line-height: 1.2; }
  .section-subtitle { font-size: 1rem; }
  .search { margin-bottom: 30px; }

  .search__input { font-size: 15px; padding: 14px 50px 14px 45px; }
  .search__icon { font-size: 15px; left: 16px; }
  .search__clear { right: 16px; width: 26px; height: 26px; font-size: 11px; }

  .subjects { gap: 12px; }
  .subject__card { padding: 18px 15px; gap: 12px; border-radius: 15px; }
  .subject__icon { width: 60px; height: 60px; font-size: 1.4rem; border-radius: 12px; }
  .subject__name { font-size: 1.2rem; margin-bottom: 6px; }
  .subject__desc { font-size: 0.85rem; line-height: 1.4; }
  .subject__arrow { font-size: 1.1rem; }

  .results-empty { padding: 60px 15px; }
  .results-empty__inner i { font-size: 3rem; margin-bottom: 20px; }
  .results-empty__inner h3 { font-size: 1.5rem; margin-bottom: 10px; }
  .results-empty__inner p { font-size: 1rem; }

  .back-to-top { width: 50px; height: 50px; bottom: 20px; right: 20px; font-size: 1.2rem; }
}

@media (max-width: 360px) {
  .section-title { font-size: 1.8rem; }
  .search { margin-bottom: 25px; }
  .subject__card { padding: 15px 12px; }
  .subject__icon { width: 55px; height: 55px; font-size: 1.3rem; }
  .subject__name { font-size: 1.1rem; }
  .subject__desc { font-size: 0.8rem; }
}

/* Focus states for accessibility */
.search__input:focus,
.subject__card:focus,
.nav__links a:focus,
.back-to-top:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Loading state */
.subjects.loading .subject__card {
  opacity: 0.5;
  transform: scale(0.95);
}

/* Search highlight */
.highlight {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
}

/* Additional utilities */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

.slide-up {
  transform: translateY(100px);
  opacity: 0;
  animation: slideUp 0.8s ease forwards;
}

@keyframes slideUp {
  to { transform: translateY(0); opacity: 1; }
}

/* Print styles */
@media print {
  .bg-animated,
  .shapes-floating,
  .grid-tech,
  .back-to-top {
    display: none;
  }

  .header-nav {
    position: static;
    background: white;
    box-shadow: none;
  }

  .content-main { padding-top: 0; }
  .subject__card { break-inside: avoid; page-break-inside: avoid; }
}
