/* Code Assets Page Styling */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-image: url("../../images/bg/modsclub.webp");
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  position: relative;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  color: #ffffff;
  overflow-y: auto;
}

/* Dark overlay */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: -1;
}

main {
  padding: 80px 20px;
}

/* Main Container */
#code-container {
  max-width: 1400px;
  margin: 60px auto;
  padding: 45px 35px;
  background: linear-gradient(145deg, rgba(30, 30, 40, 0.92), rgba(45, 45, 60, 0.92));
  border-radius: 20px;
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  animation: fadeIn 1s ease;
}

/* Header Section */
.code-header {
  text-align: center;
  margin-bottom: 50px;
}

.code-header h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  color: #ffffff;
  background: linear-gradient(135deg, #ffffff, #2ecc71, #27ae60);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px rgba(46, 204, 113, 0.7);
  letter-spacing: 1px;
  font-weight: 800;
}

.code-tagline {
  max-width: 850px;
  margin: 0 auto;
  font-size: 1.25rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

/* Category Navigation */
.category-nav {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  position: relative;
}

.category-nav::after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  height: 3px;
  width: 120px;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0),
    #2ecc71,
    #27ae60,
    rgba(255, 255, 255, 0)
  );
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.5);
}

.category-btn {
  padding: 12px 25px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 25px;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.category-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.category-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-3px);
  border-color: rgba(46, 204, 113, 0.5);
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.category-btn:hover::before {
  left: 100%;
}

.category-btn:hover::before {
  left: 100%;
}

.category-btn.active {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  border: 2px solid rgba(46, 204, 113, 0.7);
  box-shadow: 
    0 6px 25px rgba(46, 204, 113, 0.5),
    0 0 30px rgba(46, 204, 113, 0.3);
  transform: translateY(-2px);
}

/* Search and Filter */
.search-filter-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 0 auto 35px;
  width: 100%;
  max-width: 900px;
  align-items: stretch;
}

.search-box {
  display: flex;
  gap: 12px;
  width: 100%;
}

.search-box input {
  flex: 1;
  padding: 14px 22px;
  border: 2px solid rgba(46, 204, 113, 0.5);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 1.05rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.search-box input:focus {
  outline: none;
  border-color: #2ecc71;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 
    0 0 20px rgba(46, 204, 113, 0.6),
    0 4px 15px rgba(46, 204, 113, 0.3);
  transform: translateY(-2px);
}

.search-box button {
  padding: 14px 32px;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  min-width: fit-content;
}

.search-box button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.search-box button:hover {
  background: linear-gradient(135deg, #33d176, #2cc36a);
  transform: translateY(-3px);
  box-shadow: 
    0 8px 25px rgba(46, 204, 113, 0.6),
    0 0 30px rgba(39, 174, 96, 0.4);
}

.search-box button:hover::before {
  left: 100%;
}

.search-box button:active {
  transform: translateY(-1px);
}

.filter-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.filter-container select {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid rgba(46, 204, 113, 0.5);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='%23ffffff'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  min-width: 180px;
}

.filter-container select option {
  background-color: #2a2a3a;
  color: white;
  padding: 10px;
}

.filter-container select:hover {
  border-color: #2ecc71;
  background-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.filter-container select:focus {
  outline: none;
  border-color: #2ecc71;
  box-shadow: 
    0 0 20px rgba(46, 204, 113, 0.6),
    0 4px 15px rgba(46, 204, 113, 0.3);
}

/* Code Grid Layout */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 35px;
  margin-bottom: 50px;
}

/* Grid refreshing animation */
.code-grid.refreshing {
  opacity: 0.6;
  transition: opacity 0.3s ease;
  position: relative;
  animation: flash-highlight 0.6s ease-out;
}

.code-grid.refreshing::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 4px solid rgba(46, 204, 113, 0.3);
  border-radius: 50%;
  border-top-color: #2ecc71;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
}

@keyframes flash-highlight {
  0% {
    background-color: rgba(46, 204, 113, 0.15);
  }
  100% {
    background-color: transparent;
  }
}

@keyframes spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Code Card Styling */
.code-card {
  background: linear-gradient(145deg, rgba(35, 35, 50, 0.95), rgba(45, 45, 65, 0.95));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 
    0 10px 35px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fadeIn 0.8s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(46, 204, 113, 0.3);
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.code-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 0%, rgba(46, 204, 113, 0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 1;
}

.code-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 
    0 18px 50px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(46, 204, 113, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: rgba(46, 204, 113, 0.6);
}

.code-card:hover::before {
  opacity: 1;
}

/* Code visualizer area at the top of each card */
.code-visualizer {
  height: 90px;
  background: linear-gradient(to bottom, rgba(46, 204, 113, 0.25), rgba(30, 30, 40, 0.15));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 2px solid rgba(46, 204, 113, 0.2);
  z-index: 2;
}

.code-card:hover .code-visualizer {
  background: linear-gradient(to bottom, rgba(46, 204, 113, 0.35), rgba(30, 30, 40, 0.25));
  border-bottom-color: rgba(46, 204, 113, 0.4);
}

/* Code pattern in visualizer */
.code-pattern {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(46, 204, 113, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 204, 113, 0.4) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: center;
  transition: opacity 0.3s ease;
}

.code-card:hover .code-pattern {
  opacity: 0.3;
}

.code-header-area {
  padding: 22px 22px 8px 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 2;
}

.code-title {
  margin: 0;
  font-size: 1.45rem;
  color: #ffffff;
  line-height: 1.3;
  flex-grow: 1;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff, #2ecc71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
}

.code-card:hover .code-title {
  text-shadow: 0 0 20px rgba(46, 204, 113, 0.8);
}

.code-type {
  display: inline-block;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.4), rgba(39, 174, 96, 0.3));
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 15px;
  margin-left: 10px;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.code-card:hover .code-type {
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.5), rgba(39, 174, 96, 0.4));
  transform: scale(1.05);
}

.code-meta {
  padding: 0 22px 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  color: #b8b8b8;
  position: relative;
  z-index: 2;
}

.code-author,
.code-complexity {
  color: #e8e8e8;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.3s ease;
}

.code-card:hover .code-author,
.code-card:hover .code-complexity {
  color: #2ecc71;
}

.code-description {
  padding: 0 22px 18px;
  color: #d8d8d8;
  font-size: 1rem;
  line-height: 1.6;
  position: relative;
  z-index: 2;
}

/* Code Preview Styling */
.code-preview-container {
  margin: 0 20px 15px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #282c34;
}

.code-toolbar {
  background: linear-gradient(
    to right,
    rgba(46, 204, 113, 0.2),
    rgba(39, 174, 96, 0.1),
    #21252b
  );
  padding: 8px 12px;
  color: #abb2bf;
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #181a1f;
}

.copy-button {
  background: transparent;
  border: none;
  color: #abb2bf;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.copy-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.code-preview-container pre {
  margin: 0;
  padding: 15px;
  overflow-x: auto;
  max-height: 250px;
}

.code-preview-container code {
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  tab-size: 4;
}

/* Section Line for code sections */
.section-line {
  height: 3px;
  width: 100px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(46, 204, 113, 0.7),
    rgba(255, 255, 255, 0)
  );
  margin: 0 auto 30px;
}

/* Usage Instructions */
.code-usage {
  padding: 0 20px 15px;
}

.code-usage h4 {
  color: #ffffff;
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.code-usage ol {
  margin: 0;
  padding-left: 20px;
  color: #d5d5d5;
  font-size: 0.95rem;
  line-height: 1.5;
}

.code-usage li {
  margin-bottom: 5px;
}

/* Notes Section */
.code-notes {
  padding: 15px 20px;
  background: linear-gradient(to bottom, rgba(46, 204, 113, 0.05), transparent);
  border-radius: 0 0 8px 8px;
  margin: 0 5px;
}

.code-notes h4 {
  color: #ffffff;
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.code-notes p {
  margin: 0;
  color: #d5d5d5;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Action Buttons */
.code-actions {
  display: flex;
  gap: 12px;
  padding: 18px 22px;
  margin-top: auto;
  position: relative;
  z-index: 2;
}

.view-details-button,
.download-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex: 1;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.view-details-button::before,
.download-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.view-details-button {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
}

.view-details-button:hover {
  background: linear-gradient(135deg, #33d176, #2cc36a);
  transform: translateY(-3px);
  box-shadow: 
    0 6px 20px rgba(46, 204, 113, 0.6),
    0 0 25px rgba(39, 174, 96, 0.4);
}

.view-details-button:hover::before {
  left: 100%;
}

.download-button {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.download-button:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.download-button:hover::before {
  left: 100%;
}

/* No results message */
.no-results {
  text-align: center;
  padding: 50px 40px;
  background: linear-gradient(145deg, rgba(35, 35, 50, 0.9), rgba(45, 45, 65, 0.9));
  border-radius: 16px;
  margin: 30px auto;
  max-width: 600px;
  box-shadow: 
    0 10px 35px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(46, 204, 113, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.no-results h2 {
  background: linear-gradient(135deg, #ffffff, #2ecc71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 15px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 60px 0 40px;
  gap: 25px;
  flex-wrap: wrap;
}

.pagination-button {
  padding: 14px 26px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
  position: relative;
  overflow: hidden;
}

.pagination-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.pagination-button:hover {
  background: linear-gradient(135deg, #33d176, #2cc36a);
  transform: translateY(-3px);
  box-shadow: 
    0 8px 25px rgba(46, 204, 113, 0.6),
    0 0 30px rgba(39, 174, 96, 0.4);
}

.pagination-button:hover::before {
  left: 100%;
}

.pagination-button:active {
  transform: translateY(-1px);
}

.pagination-button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #555, #777);
  box-shadow: none;
}

.pagination-button[disabled]:hover {
  transform: none;
  box-shadow: none;
}

.pagination-button[disabled]::before {
  display: none;
}

.pagination-info {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Footer Section */
.code-footer {
  background: rgba(30, 30, 40, 0.85);
  border-radius: 15px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.code-footer h2 {
  font-size: 2.2rem;
  margin-bottom: 15px;
  color: #ffffff;
  text-shadow: 0 0 5px rgba(46, 204, 113, 0.4);
}

.code-footer p {
  max-width: 700px;
  margin: 0 auto 25px;
  font-size: 1.1rem;
  color: #e0e0e0;
}

.contribute-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 8px;
  background: linear-gradient(
    135deg,
    rgba(46, 204, 113, 0.8),
    rgba(39, 174, 96, 0.8)
  );
  color: white;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.contribute-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(
    135deg,
    rgba(46, 204, 113, 1),
    rgba(39, 174, 96, 1)
  );
}

/* Template element - should never be displayed */
template {
  display: none;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Syntax highlighting overrides - better for dark mode */
.hljs {
  background: #282c34 !important;
  border-radius: 0 0 8px 8px;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .code-header h1 {
    font-size: 2.2rem;
  }

  .code-tagline {
    font-size: 1rem;
  }

  .category-nav {
    flex-wrap: wrap;
    gap: 8px;
  }

  .category-btn {
    font-size: 0.85rem;
    padding: 6px 12px;
    white-space: nowrap;
  }

  .search-filter-container {
    flex-direction: column;
    gap: 15px;
  }

  .search-box,
  .filter-container {
    width: 100%;
  }

  .code-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .code-card {
    min-height: unset;
  }

  .code-title {
    font-size: 1.2rem;
  }

  .code-preview-container {
    max-height: 200px;
    overflow-y: auto;
  }

  .code-footer {
    padding: 30px 20px;
  }

  .code-footer h2 {
    font-size: 1.8rem;
  }

  .code-footer p {
    font-size: 1rem;
  }

  .contribute-button {
    width: 100%;
    padding: 12px 20px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .code-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 2560px) {
  #code-container {
    max-width: 1800px;
  }

  .code-header h1 {
    font-size: 4rem;
  }

  .code-tagline {
    font-size: 1.5rem;
    max-width: 1000px;
  }

  .category-btn {
    font-size: 1.2rem;
    padding: 10px 20px;
  }

  .code-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .code-card h3 {
    font-size: 1.6rem;
  }
}
