:root {
  --bg-color: #12181b;
  --card-bg: #2a2e33;
  --text-primary: #ffffff;
  --text-secondary: #a0aab2;
  --accent: #00b4d8;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
}
#searchWrapper{
  flex-grow: 1; /* This tells the search area to take up all available space */
    display: flex;
}
header {
  background-color: #1e2428;
  padding: 2rem 1rem;
  text-align: center;
  border-bottom: 2px solid var(--accent);
}

.header-content h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2.5rem;
}

.header-content p {
  color: var(--text-secondary);
  margin: 0 0 1.5rem 0;
}

.controls-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
}

input[type="text"] {
  flex: 1;
  padding: 10px 15px;
  border-radius: 5px;
  border: none;
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-size: 1rem;
}

button {
  padding: 10px 20px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #0096b4;
}

button:disabled, input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.loading {
  text-align: center;
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.deck-card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
}

.deck-card:hover {
  transform: translateY(-5px);
}

.deck-title {
  font-size: 1.25rem;
  margin: 0;
  color: var(--accent);
}

.video-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 15px;
  display: inline-block;
}

.video-link:hover {
  color: white;
  text-decoration: underline;
}

.card-list {
  margin: 0;
  padding-left: 20px;
  color: #d1d5db;
  font-size: 0.9rem;
  line-height: 1.4;
  flex-grow: 1;
}

.highlight {
  color: var(--accent);
  font-weight: bold;
  font-size: 1.2rem;
}

.info-btn {
  background-color: var(--card-bg);
  color: var(--text-secondary);
  border: 2px solid var(--text-secondary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.info-btn:hover {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--card-bg);
  margin: 10% auto;
  padding: 30px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  width: 80%;
  max-width: 600px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  position: relative;
  line-height: 1.6;
}

.modal-content h2 {
  margin-top: 0;
  color: var(--accent);
}

.modal-content li {
  margin-bottom: 10px;
}

.close-btn {
  color: var(--text-secondary);
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.deck-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 5px;
  font-style: italic;
  white-space: nowrap;
  margin-left: 10px;
}

.close-btn:hover {
  color: white;
}

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 15px;
  border-bottom: 1px solid #3a4047;
  padding-bottom: 10px;
}

.video-dropdown {
  margin-bottom: 15px;
}

.video-dropdown summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: bold;
  user-select: none;
  transition: color 0.2s;
  outline: none;
}

.video-dropdown summary:hover {
  color: var(--accent);
}

.video-preview {
  margin-top: 10px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  border: 1px solid #3a4047;
}

.video-preview img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.video-preview:hover img {
  opacity: 1;
}

.video-title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 0.8rem;
  padding: 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Download Button --- */
.download-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #2c8b5b; /* A nice, code-friendly green */
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: center;
}

.download-btn:hover {
    background-color: #236e48;
}

.download-btn:active {
    transform: scale(0.98);
}

/* --- Last Updated Stamp --- */
.last-updated {
    font-size: 0.85rem;
    color: var(--text-secondary); /* or use a hex like #8b949e if you aren't using variables */
    margin-top: -10px; /* Pulls it slightly closer to the text above it */
    margin-bottom: 15px;
    font-style: italic;
}

/* --- Stats Modal Adjustments --- */
.stats-content {
    max-width: 800px; /* Make the stats box wider than the info box */
    width: 90%;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    margin-top: 20px;
}

.hidden { display: none !important; }

.stats-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background: #161b22;
    border-radius: 12px;
    border: 1px solid #30363d;
}

.chart-box {
    background: #0d1117;
    padding: 20px;
    border-radius: 8px;
    height: 500px; /* Bigger height since it's a full page now */
    margin-top: 20px;
}

#backBtn {
    background-color: #30363d;
    color: white;
}

#backBtn:hover {
    background-color: #484f58;
}

/* --- Stats Dashboard Layout --- */
.stats-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    color: #c9d1d9;
}

.summary-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.stat-card h3 {
    margin: 0;
    font-size: 1rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card p {
    margin: 10px 0 0 0;
    font-size: 2.5rem;
    font-weight: bold;
    color: #2ea043;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.chart-box.full-width {
    grid-column: 1 / -1;
}

.chart-box h3 {
    margin-top: 0;
    margin-bottom: 5px;
    color: #e6edf3;
}

.chart-subtitle {
    font-size: 0.85rem;
    color: #8b949e;
    margin-top: 0;
    margin-bottom: 15px;
}

.canvas-wrapper {
    position: relative;
    height: 300px; /* Forces charts to maintain a consistent height */
    width: 100%;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}