:root {
  --primary-color: #ff9000;
  --primary-light: #ffb366;
  --primary-dark: #cc7300;
  --bg-color: #0d0d0d;
  --card-bg-color: #1a1a1a;
  --card-hover-color: #252525;
  --text-color: #fff;
  --text-secondary: #cccccc;
  --text-muted: #888888;
  --secondary-color: #2a2a2a;
  --shadow-color: rgba(0, 0, 0, 0.2);
  --shadow-hover: rgba(0, 0, 0, 0.4);
  --transition-speed: 0.3s;
  --transition-fast: 0.15s;
  --border-radius: 12px;
  --card-radius: 16px;
  --header-height: 80px;
  --nav-height: 60px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 144, 0, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(255, 144, 0, 0.05) 0%, transparent 50%);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 20px var(--shadow-color);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--primary-color));
  animation: gradient-shift 5s ease infinite;
  background-size: 200% 100%;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(255, 144, 0, 0.3);
  position: relative;
  z-index: 1;
}

nav {
  background: linear-gradient(135deg, var(--card-bg-color) 0%, #222222 100%);
  padding: 0.8rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 15px var(--shadow-color);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

nav ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

nav li {
  margin: 0;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 2rem;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

nav a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  transition: width var(--transition-speed);
  z-index: -1;
}

nav a:hover::before,
nav a.active::before {
  width: 100%;
}

nav a:hover,
nav a.active {
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 144, 0, 0.3);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Search bar styles */
.search-container {
  margin: 2rem 0;
  text-align: center;
  position: relative;
}

.search-box {
  width: 100%;
  max-width: 500px;
  padding: 1rem 1.5rem;
  border-radius: 2.5rem;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--card-bg-color) 0%, #222222 100%);
  color: var(--text-color);
  font-size: 1rem;
  outline: none;
  transition: all var(--transition-speed);
  box-shadow: 0 4px 15px var(--shadow-color);
}

.search-box:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 144, 0, 0.2), 0 4px 20px var(--shadow-hover);
  transform: translateY(-2px);
}

.search-box::placeholder {
  color: var(--text-muted);
}

.category-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 2.5rem 0 1.5rem;
  color: var(--primary-color);
  padding-left: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  display: inline-block;
}

.category-title::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  border-radius: 2px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.link-card {
  background: linear-gradient(135deg, var(--card-bg-color) 0%, #222222 100%);
  border-radius: var(--card-radius);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px var(--shadow-color);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.link-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  transform: scaleX(0);
  transition: transform var(--transition-fast);
  transform-origin: left;
}

.link-card a {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-decoration: none;
  z-index: 12;
  display: block;
}

.link-card:hover {
  background: linear-gradient(135deg, var(--card-hover-color) 0%, #2a2a2a 100%);
  transform: translateY(-5px);
  box-shadow: 0 8px 25px var(--shadow-hover);
}

.link-card:hover::before {
  transform: scaleX(1);
}

.link-card i {
  font-size: 2.2rem;
  margin-bottom: 0.8rem;
  color: var(--primary-color);
  transition: all var(--transition-fast);
  position: relative;
  z-index: 11;
  filter: drop-shadow(0 2px 3px rgba(255, 144, 0, 0.2));
}

.link-card:hover i {
  transform: scale(1.15) translateY(-3px);
  filter: drop-shadow(0 4px 6px rgba(255, 144, 0, 0.4));
}

.link-card h3 {
  font-size: 1rem;
  margin: 0;
  color: var(--text-color);
  line-height: 1.4;
  font-weight: 600;
  max-width: 100%;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  white-space: normal;
  padding: 0 0.3rem;
  position: relative;
  z-index: 11;
  transition: color var(--transition-fast);
}

.link-card:hover h3 {
  color: var(--primary-light);
}

footer {
  background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
  margin-top: 3rem;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--primary-color));
  animation: gradient-shift 5s ease infinite;
  background-size: 200% 100%;
}

footer nav {
  margin-top: 1rem;
  background-color: transparent;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

footer nav a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border-radius: 1rem;
  transition: all var(--transition-fast);
  position: relative;
}

footer nav a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  transition: width var(--transition-fast);
  z-index: -1;
  border-radius: 1rem;
}

footer nav a:hover::before {
  width: 100%;
}

footer nav a:hover {
  color: #000;
  transform: translateY(-2px);
}

/* Search bar styles */
.search-container {
  margin: 1rem 0;
  text-align: center;
}

.search-box {
  width: 100%;
  max-width: 500px;
  padding: 0.8rem;
  border-radius: 2rem;
  border: 2px solid var(--primary-color);
  background-color: var(--card-bg-color);
  color: var(--text-color);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition-speed);
}

.search-box:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 144, 0, 0.3);
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: linear-gradient(135deg, var(--card-bg-color) 0%, #222222 100%);
  color: var(--text-color);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 1001;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--shadow-color);
  overflow: hidden;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: -1;
}

.theme-toggle:hover {
  transform: scale(1.15) translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 144, 0, 0.4);
}

.theme-toggle:hover::before {
  opacity: 1;
}

.theme-toggle:active {
  transform: scale(1.05);
}

.theme-toggle i {
  transition: transform var(--transition-fast);
}

.theme-toggle:hover i {
  transform: rotate(30deg);
}

/* Loading animation */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s;
}

.loading-spinner {
  width: 4rem;
  height: 4rem;
  border: 0.4rem solid rgba(255, 144, 0, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Light theme styles */
body.light-theme {
  --bg-color: #f8f9fa;
  --card-bg-color: #ffffff;
  --card-hover-color: #f1f3f5;
  --text-color: #212529;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --secondary-color: #e9ecef;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --shadow-hover: rgba(0, 0, 0, 0.15);
}

body.light-theme {
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 144, 0, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(255, 144, 0, 0.05) 0%, transparent 50%);
}

body.light-theme header {
  background: linear-gradient(135deg, #343a40 0%, #495057 100%);
}

body.light-theme header::before {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--primary-color));
}

body.light-theme nav {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme footer {
  background: linear-gradient(135deg, #343a40 0%, #495057 100%);
  color: #f8f9fa;
}

body.light-theme footer::before {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--primary-color));
}

body.light-theme footer nav a {
  color: #f8f9fa;
}

body.light-theme footer nav a:hover {
  color: #000;
}

body.light-theme .search-box {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #e9ecef;
}

body.light-theme .search-box:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 144, 0, 0.15), 0 4px 20px var(--shadow-hover);
}

body.light-theme .link-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .link-card:hover {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

body.light-theme .theme-toggle {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #e9ecef;
  color: var(--text-color);
}

body.light-theme .theme-toggle:hover::before {
  opacity: 1;
}

body.light-theme .theme-toggle:hover {
  color: #000;
}

/* Responsive styles */
@media (max-width: 1200px) {
  main {
    padding: 1rem;
    max-width: 95%;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.2rem;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  body {
    background-image:
      radial-gradient(circle at 10% 20%, rgba(255, 144, 0, 0.03) 0%, transparent 50%),
      radial-gradient(circle at 90% 80%, rgba(255, 144, 0, 0.03) 0%, transparent 50%);
  }

  main {
    padding: 0.8rem;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
  }

  nav {
    padding: 0.4rem;
  }

  nav a {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }

  .category-title {
    font-size: 1.6rem;
    margin: 2rem 0 1rem;
  }

  .link-card {
    padding: 1.2rem 0.8rem;
    min-height: 100px;
  }

  .link-card i {
    font-size: 1.8rem;
    margin-bottom: 0.6rem;
  }

  .link-card h3 {
    font-size: 0.9rem;
    height: 2.6em;
  }

  .theme-toggle {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  body {
    background-image:
      radial-gradient(circle at 10% 20%, rgba(255, 144, 0, 0.02) 0%, transparent 50%),
      radial-gradient(circle at 90% 80%, rgba(255, 144, 0, 0.02) 0%, transparent 50%);
  }

  main {
    padding: 0.6rem;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.8rem;
  }

  header h1 {
    font-size: 1.8rem;
    letter-spacing: 1px;
  }

  nav {
    padding: 0.3rem;
  }

  nav li {
    margin: 0.2rem;
  }

  nav a {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }

  .category-title {
    font-size: 1.5rem;
    margin: 1.8rem 0 1rem;
  }

  .link-card {
    padding: 1rem 0.6rem;
    min-height: 90px;
  }

  .link-card i {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
  }

  .link-card h3 {
    font-size: 0.8rem;
    padding: 0 0.2rem;
    height: 2.4em;
  }

  footer {
    padding: 1.5rem 0.8rem;
  }

  footer nav a {
    margin: 0 0.4rem;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
  }

  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  html {
    font-size: 13px;
  }

  .link-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.7rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  nav a {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  .link-card {
    padding: 0.8rem 0.5rem;
    min-height: 85px;
  }

  .link-card i {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
  }

  .link-card h3 {
    font-size: 0.75rem;
    padding: 0 0.15rem;
    height: 2.2em;
  }

  .theme-toggle {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.9rem;
  }
}