/* Reset & base */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #121212;
  color: #eee;
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-spinner {
  border: 5px solid rgba(153, 69, 255, 0.3);
  border-radius: 50%;
  border-top: 5px solid #9945FF;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

header {
  background: linear-gradient(135deg, #1e1e1e 0%, #121212 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(153, 69, 255, 0.1);
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-center {
  display: flex;
  justify-content: center;
  flex-grow: 1;
}

.header-right {
  display: flex;
  align-items: center;
}

.action-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.action-tab {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s;
  color: white;
  white-space: nowrap;
}

.about-tab {
  background: linear-gradient(135deg, #9945FF 0%, #7a36cc 100%);
}

.buy-tab {
  background: linear-gradient(135deg, #14F195 0%, #0d9b66 100%);
}

.join-tab {
  background: linear-gradient(135deg, #1DA1F2 0%, #0d7ab8 100%);
}

.follow-tab {
  background: linear-gradient(135deg, #0088CC 0%, #006699 100%);
}

.chart-tab {
  background: linear-gradient(135deg, #FF6B6B 0%, #cc5555 100%);
}

.action-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.logo {
  width: 40px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 5px rgba(153, 69, 255, 0.5));
}

.site-title {
  margin: 0;
  font-size: 1.25rem;
  white-space: nowrap;
  color: #9945FF;
  text-shadow: 0 0 10px rgba(153, 69, 255, 0.7);
  background: linear-gradient(90deg, #9945FF 0%, #14F195 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  position: relative;
  display: inline-block;
  animation: titleGlow 2s infinite alternate, floatTitle 3s ease-in-out infinite;
  transform-style: preserve-3d;
}

@keyframes titleGlow {
  0% {
    text-shadow: 0 0 10px rgba(153, 69, 255, 0.7);
  }
  100% {
    text-shadow: 0 0 20px rgba(153, 69, 255, 0.9), 
                 0 0 30px rgba(20, 241, 149, 0.5);
  }
}

@keyframes floatTitle {
  0%, 100% {
    transform: translateY(0) rotateY(0deg);
  }
  50% {
    transform: translateY(-5px) rotateY(10deg);
  }
}

.section-heading {
  color: #9945FF;
  padding: 0 1rem;
  margin: 1.5rem 0 0.5rem 0;
  font-size: 1.5rem;
  position: relative;
  display: inline-block;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 1rem;
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, #9945FF 0%, #14F195 100%);
  border-radius: 3px;
}

nav {
  flex-grow: 1;
  min-width: 200px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  justify-content: center;
}

.tab {
  cursor: pointer;
  padding: 0.5rem 1rem;
  background-color: #2a2a2a;
  border-radius: 6px;
  user-select: none;
  color: #eee;
  transition: all 0.2s;
  font-size: 0.95rem;
  border: 1px solid #333;
}

.tab.active, .tab:hover {
  background: linear-gradient(135deg, #9945FF 0%, #14F195 100%);
  color: #121212;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(153, 69, 255, 0.3);
}

.mode-toggle {
  flex-shrink: 0;
}

#modeSwitcher {
  background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
  border: 1px solid #333;
  color: #eee;
  padding: 0.4rem 0.7rem;
  font-size: 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#modeSwitcher:hover {
  background: linear-gradient(135deg, #9945FF 0%, #14F195 100%);
  color: #121212;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(153, 69, 255, 0.3);
}

/* Ticker section */
.ticker {
  background: linear-gradient(135deg, #1f1f1f 0%, #171717 100%);
  color: white;
  padding: 0.5rem 1rem;
  font-weight: 600;
  overflow: hidden;
  font-size: 0.9rem;
  user-select: none;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}

#crypto-slider {
  display: inline-block;
  padding-left: 100%;
  white-space: nowrap;
  animation: slide 80s linear infinite; /* Slowed down significantly */
}

#crypto-slider:hover {
  animation-play-state: paused;
}

.crypto-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0.5rem;
}

.crypto-item img {
  border-radius: 50%;
}

.action-tabs-container {
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
  padding: 0.5rem 0;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* For light mode */
body.light-mode .action-tabs-container {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
}

@keyframes slide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
 }


/* RSS ticker */
.rss-ticker {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #222 0%, #1a1a1a 100%);
  font-size: 0.9rem;
  color: #ccc;
  user-select: none;
  border-bottom: 1px solid #333;
}

/* Search */
.search {
  padding: 1rem 1rem 0 1rem;
  background-color: #1c1c1c;
  text-align: center;
}

#searchInput {
  width: 90%;
  max-width: 480px;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #333;
  font-size: 1rem;
  background-color: #2a2a2a;
  color: #eee;
  transition: all 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#searchInput:focus {
  outline: none;
  border-color: #9945FF;
  box-shadow: 0 0 0 2px rgba(153, 69, 255, 0.3);
}

/* Category tabs moved below search */
.category-tabs-container {
  background: linear-gradient(135deg, #1e1e1e 0%, #121212 100%);
  padding: 0.5rem 1rem;
  position: sticky;
  top: 60px; /* Below header */
  z-index: 999;
  border-bottom: 1px solid #333;
}

/* News grid & cards */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
}

.news-card {
  position: relative;
  background: linear-gradient(135deg, #222 0%, #1a1a1a 100%);
  padding: 1rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100px;
  transition: all 0.3s;
  border: 1px solid #333;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.news-card-source {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.7rem;
  color: #aaa;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-style: italic;
}

/* Light mode adjustments */
body.light-mode .news-card-source {
  color: #666;
  background: rgba(255, 255, 255, 0.7);
}

.news-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgba(153, 69, 255, 0.2);
  border-color: #9945FF;
}

.news-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.3s;
}

.news-card:hover img {
  transform: scale(1.03);
}

.news-card-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  flex: 1;
}

.news-card h4 {
  margin: 0 0 0.4rem 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.news-card h4 a {
  color: #eee;
  text-decoration: none;
  word-break: break-word;
  background: linear-gradient(90deg, #9945FF 0%, #14F195 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
  transition: all 0.2s;
}

.news-card h4 a:hover {
  text-decoration: underline;
  text-shadow: 0 0 8px rgba(153, 69, 255, 0.3);
}

.news-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #bbb;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  max-height: 4.2em; /* approx 3 lines */
}

/* Load More button */
button#loadMore {
  background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
  color: white;
  border: 1px solid #333;
  padding: 0.75rem 1.5rem;
  margin: 2rem auto 3rem auto;
  border-radius: 6px;
  cursor: pointer;
  display: block;
  font-size: 1rem;
  transition: all 0.3s;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

button#loadMore:hover {
  background: linear-gradient(135deg, #9945FF 0%, #14F195 100%);
  color: #121212;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(153, 69, 255, 0.3);
}

/* Footer & Social */
footer {
  background: linear-gradient(135deg, #111 0%, #000 100%);
  padding: 1.5rem 0;
  text-align: center;
  border-top: 1px solid #333;
}

.social-icons a {
  margin: 0 12px;
  color: #bbb;
  font-size: 1.5rem;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.social-icons a:hover {
  color: #9945FF;
  transform: translateY(-3px);
  text-shadow: 0 0 10px rgba(153, 69, 255, 0.5);
}

/* Light mode */
body.light-mode {
  background-color: #f9f9f9;
  color: #222;
}

body.light-mode header {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  box-shadow: 0 4px 20px rgba(153, 69, 255, 0.15);
}

body.light-mode .site-title {
  text-shadow: 0 0 10px rgba(153, 69, 255, 0.4);
}

body.light-mode .tab {
  background-color: #f0f0f0;
  border-color: #ddd;
  color: #444;
}

body.light-mode .tab.active,
body.light-mode .tab:hover {
  color: #fff;
}

body.light-mode #modeSwitcher {
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
  border-color: #ddd;
  color: #444;
}

body.light-mode #modeSwitcher:hover {
  color: #fff;
}

body.light-mode .ticker,
body.light-mode .rss-ticker,
body.light-mode .search,
body.light-mode .news-card {
  background: linear-gradient(135deg, #fff 0%, #f5f5f5 100%);
  color: #222;
  border-color: #eee;
}

body.light-mode .news-card:hover {
  box-shadow: 0 8px 20px rgba(153, 69, 255, 0.15);
}

body.light-mode .news-card h4 a {
  color: #222;
}

body.light-mode button#loadMore {
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
  border-color: #ddd;
  color: #444;
}

body.light-mode button#loadMore:hover {
  color: #fff;
}

body.light-mode footer {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  border-top-color: #eee;
}

body.light-mode .social-icons a {
  color: #666;
}

body.light-mode .social-icons a:hover {
  color: #9945FF;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .action-tab {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  
  .action-tab i {
    display: none;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: row;
    padding: 0.5rem;
  }
  
  .header-center {
    order: 3;
    flex-basis: 100%;
    margin-top: 0.5rem;
  }
  
  .action-tabs {
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }
  
  .action-tab {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }
  
  .category-tabs-container {
    top: 50px; /* Adjusted for smaller header */
  }
  
  .tab {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 1rem;
  }
  
  .action-tab {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }
  
  .logo {
    width: 30px;
  }
}
