/* ==========================================================================
   Base Styles
   ========================================================================== */
:root {
  --primary-color: #ff5e62;
  --primary-hover: #e05559;
  --positive-color: #00C851;
  --positive-hover: #009c3b;
  --negative-color: #ff4444;
  --text-dark: #333;
  --text-dark-alt: #222;
  --text-medium: #555;
  --text-light: #fbfbfb;
  --border-color: #ddd;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Special Elite', monospace;
  background: url('/images/mainBackground.png') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-top: 60px;
  padding: 20px;
  box-sizing: border-box;
}

/* ==========================================================================
   Title Section
   ========================================================================== */
.title-section-token {
  background: rgba(255, 94, 98, 0.85); /* #ff5e62d8 */
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  color: var(--text-light);
}

.title-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.title-heading,
.title-description {
  color: var(--text-light);
  margin: 10px auto;
  text-align: center;
  max-width: 800px;
  line-height: 1.4;
}

.title-heading {
  font-size: 20px;
  font-weight: bold;
}

.title-description {
  font-size: 14px;
  margin-bottom: 15px;
}

.manual-link {
  background-color: var(--positive-color);
  color: var(--text-light);
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-family: 'Special Elite', monospace;
  font-size: 16px;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

.manual-link:hover {
  background-color: var(--positive-hover);
}

/* ==========================================================================
   Token Rating Section
   ========================================================================== */
.token-rating-section {
  grid-column: 1 / -1;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  box-sizing: border-box;
}

.token-data-container {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 50px;
  box-shadow: var(--shadow-md);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Table Styles
   ========================================================================== */
#tokenRatingTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
}

th {
  background-color: var(--primary-color);
  color: black;
  font-weight: bold;
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

th[data-column="name"],
td[data-column="name"] {
  max-width: 75ch;
  width: 75ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

tr:nth-child(even) {
  background-color: rgba(242, 242, 242, 0.8);
}

tr:hover {
  background-color: rgba(221, 221, 221, 0.8);
  cursor: pointer;
}

tr.bullish {
  background-color: rgba(0, 200, 81, 0.1);
}

tr.bearish {
  background-color: rgba(255, 68, 68, 0.1);
}

tr.neutral {
  background-color: rgba(51, 181, 229, 0.1);
}

td.positive {
  color: var(--positive-color);
  font-weight: bold;
}

td.negative {
  color: var(--negative-color);
  font-weight: bold;
}

/* Scrollbar Styling */
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ==========================================================================
   Overlay Styles
   ========================================================================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  font-family: 'Special Elite', monospace;
  border: 1px solid var(--border-color);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--primary-color);
  color: var(--text-light);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, transform 0.2s;
}

.close-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.1);
}

.close-btn-bottom {
  background-color: var(--primary-color);
  color: var(--text-light);
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-family: 'Special Elite', monospace;
  font-size: 16px;
}

.close-btn-bottom:hover {
  background-color: var(--primary-hover);
}

/* ==========================================================================
   Token Card Styles
   ========================================================================== */
.token-card {
  padding: 20px;
}

.token-card-header {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 12px;
  margin-bottom: 20px;
  background: rgba(255, 94, 98, 0.1);
  border-radius: 8px;
  padding: 12px;
}

.token-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 15px;
  object-fit: contain;
  background: #fff;
}

.token-logo[src="/images/placeholder-logo.png"] {
  opacity: 0.5;
}

.token-card-title {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.token-card-header h3 {
  margin: 0;
  font-size: 1.8em;
  color: var(--text-dark);
}

.token-symbol {
  font-size: 1.3em;
  color: var(--text-medium);
  font-weight: bold;
}

.token-card-section {
  margin-bottom: 20px;
}

.token-card-section h4 {
  margin: 0 0 12px;
  font-size: 1.4em;
  color: var(--primary-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 5px;
}

.token-card-section p {
  margin: 8px 0;
  font-size: 1em;
  display: flex;
  align-items: center;
  color: var(--text-dark);
}

.token-card-section p.positive {
  color: var(--positive-color);
  font-weight: bold;
}

.token-card-section p.negative {
  color: var(--negative-color);
  font-weight: bold;
}

.token-card-section p strong {
  width: 140px;
  font-weight: 600;
  color: var(--text-dark-alt);
}

.token-card-section a {
  color: var(--positive-color);
  text-decoration: none;
  transition: color 0.3s;
}

.token-card-section a:hover {
  color: var(--positive-hover);
  text-decoration: underline;
}

.token-card-buttons,
.manual-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Manual Overlay Content
   ========================================================================== */
.manual-content {
  padding: 20px;
  color: var(--text-dark);
  font-size: 1em;
  line-height: 1.5;
}

.manual-content h1,
.manual-content h2,
.manual-content h3,
.manual-content h4 {
  color: var(--primary-color);
  margin: 10px 0;
}

.manual-content p {
  margin: 8px 0;
}

.manual-content a {
  color: var(--positive-color);
  text-decoration: none;
}

.manual-content a:hover {
  color: var(--positive-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */
.sort-btn {
  background-color: var(--primary-color);
  color: var(--text-light);
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-family: 'Special Elite', monospace;
  font-size: 16px;
  margin-left: 10px;
}

.sort-btn:hover {
  background-color: var(--primary-hover);
}

.search-input {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-left: 10px;
  width: 200px;
  font-family: 'Special Elite', monospace;
  font-size: 16px;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 5px rgba(255, 94, 98, 0.5);
}

.token-data-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.hidden {
  display: none;
}

.error-message {
  background: var(--negative-color);
  color: var(--text-light);
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  text-align: center;
  font-size: 0.9em;
}

.loading-spinner {
  text-align: center;
  font-size: 1em;
  color: var(--primary-color);
  padding: 10px;
  margin-bottom: 15px;
}

.loading-spinner.hidden {
  display: none;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1200px) {
  .token-rating-section {
    padding: 15px;
  }

  .token-data-container {
    padding: 15px;
  }

  .overlay-content {
    max-width: 95%;
  }
}

@media (max-width: 768px) {
  .token-rating-section {
    padding: 10px;
    max-width: 100%;
    margin-bottom: 80px;
  }

  .token-data-container {
    padding: 10px;
  }

  .title-section-token {
    font-size: 20px;
  }

  .title-heading {
    font-size: 18px;
  }

  .title-description {
    font-size: 12px;
    margin: 8px auto 10px;
  }

  .manual-link {
    font-size: 14px;
    padding: 8px 16px;
  }

  .token-data-container th,
  .token-data-container td {
    padding: 8px;
    font-size: 14px;
  }

  .token-data-header {
    flex-direction: column;
    align-items: stretch;
  }

  .sort-btn,
  .search-input {
    width: 100%;
    margin: 5px 0;
    padding: 10px;
    font-size: 14px;
  }

  .search-input {
    width: 100%;
    max-width: none;
  }

  .overlay-content {
    max-width: 95%;
    padding: 15px;
    max-height: 85vh;
  }

  .token-card {
    padding: 15px;
  }

  .token-card-header h3 {
    font-size: 1.5em;
  }

  .token-symbol {
    font-size: 1.1em;
  }

  .token-card-section h4 {
    font-size: 1.2em;
  }

  .token-card-section p {
    font-size: 0.9em;
  }

  .token-card-section p strong {
    width: 120px;
  }

  .close-btn {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .close-btn-bottom {
    font-size: 14px;
    padding: 8px 16px;
  }

  .token-logo {
    width: 32px;
    height: 32px;
  }

  .manual-content {
    padding: 15px;
    font-size: 0.9em;
  }
}

@media (max-width: 480px) {
  .token-data-container th,
  .token-data-container td {
    padding: 6px;
    font-size: 11px;
  }

  .title-heading {
    font-size: 16px;
  }

  .title-description {
    font-size: 11px;
    margin: 8px auto 8px;
  }

  .manual-link {
    font-size: 12px;
    padding: 6px 12px;
  }

  .sort-btn,
  .search-input {
    padding: 8px;
    font-size: 12px;
  }

  .token-card-header h3 {
    font-size: 1.3em;
  }

  .token-symbol {
    font-size: 1em;
  }

  .token-card-section p {
    font-size: 0.85em;
  }

  .token-card-section p strong {
    width: 100px;
  }

  .close-btn {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }

  .close-btn-bottom {
    font-size: 12px;
    padding: 6px 12px;
  }

  .token-logo {
    width: 28px;
    height: 28px;
  }

  .manual-content {
    padding: 10px;
    font-size: 0.85em;
  }
}