:root {
  --primary: #4dabf7;
  --secondary: #74c0fc;
  --dark: #2d3436;
  --light: #f5f6fa;
  --success: #00b894;
  --danger: #d63031;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background: linear-gradient(135deg, #1e1e2f, #2a2a3a);
  color: var(--light);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Navbar Styles */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-back {
  color: var(--light);
  font-size: 1.2rem;
  text-decoration: none;
}

.nav-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--secondary);
}

/* Categories Styles */
.categories-container {
  position: relative;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.categories {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
  position: relative;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.category-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.category-btn.active {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  color: white;
  border-color: transparent;
  box-shadow: 0 5px 15px rgba(77, 171, 247, 0.3);
}

/* Scroll indicators for mobile */
.scroll-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  z-index: 10;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.scroll-indicator:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.scroll-indicator.left {
  left: 0;
}

.scroll-indicator.right {
  right: 0;
}

.categories-container:hover .scroll-indicator {
  opacity: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeInDown 1s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  justify-content: center;
}

.logo img {
  height: 45px;
  width: auto;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-bar {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  width: 100%;
}

.search-bar:hover {
  background: rgba(255, 255, 255, 0.15);
}

.search-bar input {
  background: transparent;
  border: none;
  color: white;
  padding: 0.5rem;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
}

.search-bar i {
  color: var(--secondary);
  font-size: 0.9rem;
}

.code-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.code-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.2rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  transform: translateY(20px);
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

.code-card:nth-child(1) { animation-delay: 0.2s; }
.code-card:nth-child(2) { animation-delay: 0.4s; }
.code-card:nth-child(3) { animation-delay: 0.6s; }
.code-card:nth-child(4) { animation-delay: 0.8s; }

.code-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  cursor: pointer;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.badge {
  background: var(--primary);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.card-body {
  margin-bottom: 1.2rem;
  display: none;
}

.card-body.expanded {
  display: block;
}

.code-container {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  word-break: break-all;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.code-container pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  max-width: 100%;
  word-break: break-word;
}

.copy-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.7rem;
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
  min-width: 0;
}

.copy-btn:hover {
  background: var(--primary);
}

.file-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.stats {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.stats span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stats i {
  font-size: 0.7rem;
}

footer {
  text-align: center;
  margin-top: 3rem;
  padding: 1.5rem 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  animation: fadeIn 1s ease 1s forwards;
  opacity: 0;
}

.toggle-arrow {
  transition: transform 0.3s ease;
}

.toggle-arrow.expanded {
  transform: rotate(180deg);
}

@keyframes fadeInUp {
  from {
      opacity: 0;
      transform: translateY(20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
      opacity: 0;
      transform: translateY(-20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Floating animation for decorative elements */
.floating {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 171, 247, 0.2) 0%, rgba(77, 171, 247, 0) 70%);
  z-index: -1;
  animation: float 6s ease-in-out infinite;
}

.floating:nth-child(1) {
  top: 20%;
  left: 10%;
  width: 200px;
  height: 200px;
  animation-delay: 0s;
}

.floating:nth-child(2) {
  top: 60%;
  right: 15%;
  width: 150px;
  height: 150px;
  animation-delay: 1s;
}

.floating:nth-child(3) {
  bottom: 10%;
  left: 20%;
  width: 100px;
  height: 100px;
  animation-delay: 2s;
}

@keyframes float {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

/* Responsive adjustments */
@media (min-width: 480px) {
  .code-grid {
      grid-template-columns: repeat(2, 1fr);
  }
  
  .logo {
      justify-content: flex-start;
  }
  
  header {
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
  }
  
  .search-bar {
      width: auto;
      min-width: 250px;
  }
}

@media (min-width: 768px) {
  .navbar {
      padding: 1rem 2rem;
  }
  
  .nav-back {
      font-size: 1.5rem;
  }
  
  .nav-title {
      font-size: 1rem;
  }
  
  .container {
      padding: 2rem;
  }
  
  header {
      margin-bottom: 3rem;
  }
  
  .logo img {
      height: 40px;
  }
  
  .logo h1 {
      font-size: 2rem;
  }
  
  .search-bar input {
      width: 200px;
      font-size: 1rem;
  }
  
  .search-bar i {
      font-size: 1rem;
  }
  
  .code-grid {
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 2rem;
  }
  
  .code-card {
      padding: 1.5rem;
      border-radius: 15px;
  }
  
  .card-title {
      font-size: 1.2rem;
  }
  
  .badge {
      padding: 0.3rem 0.8rem;
      font-size: 0.8rem;
  }
  
  .code-container {
      padding: 1rem;
      font-size: 0.9rem;
  }
  
  .copy-btn {
      padding: 0.3rem 0.6rem;
      font-size: 0.8rem;
  }
  
  .file-info {
      font-size: 0.9rem;
  }
  
  .stats {
      font-size: 0.8rem;
  }
  
  .stats i {
      font-size: 0.8rem;
  }
  
  footer {
      margin-top: 4rem;
      padding: 2rem 0;
      font-size: 0.9rem;
  }
  
  .category-btn {
      padding: 0.6rem 1.2rem;
      font-size: 0.9rem;
  }
}

@media (min-width: 1024px) {
  .categories-container {
      padding: 0;
  }
}