/* ————— COHESIVE DARK THEME 2025 ————— */
body {
    margin: 0;
    display: flex;   
    flex-direction: column;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
    line-height: 1.5;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

/* Text */
h1, h2, h3 { color: #ffffff; margin: 1.5rem 0 1rem; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; text-align: center; }

/* Links */
a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.gainers-container {
    display: flex;
    flex-direction: row;  /* Ensure side-by-side (left: sidebar, right: table) */
    width: 100%;
    align-items: flex-start;  /* Align to top instead of center to prevent vertical misalignment */
    gap: 2rem;  /* Space between sidebar and table */
    padding: 1rem;
}

aside {
    flex: 0 0 220px;  /* Fixed width for sidebar, doesn't grow/shrink */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.gainers-table-group {
    flex: 1;  /* Takes up remaining space to the right */
    min-width: 0;  /* Prevents overflow issues */
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    /* margin: 2rem 0; */
}
th, td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid #30363d;
}
th {
    background-color: #21262d;
    color: #f0f6fc;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}
tr:hover { background-color: #1f2428; }

/* Inputs & Selects */
input, select, textarea {
    background-color: #161b22;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

/* Labels */
label {
    color: #e6edf3;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

/* Sidebar */
.sidebar, .promo {
    background-color: #161b22;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #30363d;
    width: 220px;
    /* margin: 1rem; */
}
.sidebar h2 { margin-top: 0; font-size: 1.3rem; }

/* Form groups */
.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

/* Buttons (Apply / Clear / Pagination / Jump to Top) */
button, .filter-buttons button, #pagination-controls button, #jump-to-top {
    background-color: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
button:hover, .filter-buttons button:hover, #pagination-controls button:hover, #jump-to-top:hover {
    background-color: #30363d;
    border-color: #58a6ff;
    color: #ffffff;
}
button:active, .filter-buttons button:active {
    transform: translateY(1px);
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;  /* Spread out rows-per-page and controls */
    align-items: center;  /* Fix the typo 'right' — use center for vertical alignment */
    margin-top: 1.5rem;
    width: 100%;
}

#pagination-controls {
    gap: 12px;
    margin-top: 2rem;
}
#rows-per-page-div select {
    background-color: #161b22;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px;
}

/* Responsive: Stack on mobile (below 768px) */
@media (max-width: 768px) {
    .gainers-container {
        flex-direction: column;  /* Stack sidebar above table on small screens */
        align-items: center;
    }
    aside {
        flex: none;
        width: 100%;
        max-width: 300px;
    }
}

/* ——— MODERN TOP PILLS (Alternative) ——— */
/* .modern-tabs {
    display: flex;
    gap: 8px;
    padding: 1rem 2rem;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    overflow-x: auto;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.modern-tabs a {
    padding: 10px 20px;
    border-radius: 999px;
    background: transparent;
    color: #8b949e;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modern-tabs a:hover {
    background: #30363d;
    color: white;
}

.modern-tabs a.active {
    background: #238636;
    color: white;
} */


/* ——— VERTICAL SIDEBAR NAV (RECOMMENDED) ——— */
nav.sidebar-nav {
    width: 240px;
    background: #161b22;
    border-right: 1px solid #30363d;
    padding: 180px 1rem 120px;   
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    box-sizing: border-box;
}

nav.sidebar-nav h1 {
    font-size: 1.5rem;
    margin: 0 0 2rem 0;
    padding-left: 1rem;
    color: #58a6ff;
}

/* Logo container – perfectly centered at the top */
nav.sidebar-nav > .logo {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

nav.sidebar-nav > .logo a {
    pointer-events: auto;
}

/* All sidebar links (menu items) */
nav.sidebar-nav a {
    display: block;
    padding: 12px 16px;
    margin: 4px 12px;
    border-radius: 8px;
    color: #8b949e;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

nav.sidebar-nav a:hover {
    background: #21262d;
    color: #ffffff;
}

nav.sidebar-nav a.active {
    background: #1f6feb;
    color: white;
    font-weight: 600;
}

nav.sidebar-nav > .logo img {
    /* This works on Flask AND GitHub Pages */
    width: 100%;
    max-width: 220px;     /* desired max size */
    height: auto;
    object-fit: contain;
    
    /* Kill any conflicting rules from GitHub Pages or browsers */
    max-width: 220px !important;
    min-width: 0 !important;
    
    /* Keep your glow and fixes */
    forced-color-adjust: none;
    user-select: none;
    pointer-events: none;
    /* filter: drop-shadow(0 0 30px rgba(57, 255, 20, 1)); */
}

/* Push main content right */
main {
    margin-left: 240px;
    /* padding: 2rem; */
    padding-left: 2rem;
    padding-right: 2rem;
    flex: 1;
    min-height: 100vh;
    /* width: calc(100% - 240px); */
}

/* Mobile: collapse sidebar */
@media (max-width: 900px) {
    nav.sidebar-nav { width: 80px; padding: 2rem 0.5rem; }
    nav.sidebar-nav h1, nav.sidebar-nav a span { display: none; }
    nav.sidebar-nav a { padding: 16px; text-align: center; }
    main { margin-left: 80px; width: calc(100% - 80px); }
}


/* Scrollbars (Chrome/Edge) */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #58a6ff; }

/* Final touch */
* { box-sizing: border-box; }

/* Tab switching*/
.tab-content { 
    display: none; 
    padding: 1.5rem 0 2rem;
}
.tab-content.active { 
    display: block; 
}

.placeholder {
    text-align: center;
    padding: 4rem 2rem;
    color: #94a3b8;
    font-size: 1.4rem;
}
.placeholder h2 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    color: white;
}

/* ————— STATS TAB - MODERN 2025 LAYOUT ————— */
.stats-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.stats-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.stats-header h2 {
    font-size: 2.8rem;
    margin: 0 0 0.5rem;
    background: linear-gradient(90deg, #58a6ff, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chart-description {
    color: #94a3b8;
    font-size: 1.1rem;
    margin: 0;
}

.stats-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: #161b22;
    border-radius: 16px;
    border: 1px solid #30363d;
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 180px;
}

.control-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #e2e8f0;
}

.control-group select,
.control-group input {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: #0d1117;
    border: 2px solid #30363d;
    border-radius: 10px;
    color: white;
    transition: all 0.2s ease;
}

.control-group select:focus,
.control-group input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
}

.chart-card {
    background: #161b22;
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid #30363d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.chart-wrapper {
    position: relative;
    height: 500px;
    width: 100%;
}

.chart-footer {
    text-align: center;
    margin-top: 2rem;
    color: #64748b;
    font-size: 0.95rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-group {
        width: 100%;
        max-width: 300px;
    }
    
    .stats-header h2 {
        font-size: 2.2rem;
    }
}

.logo img {
  height: 42px;           /* adjust to your navbar height */
  width: auto;
  /*filter: drop-shadow(0 0 8px rgba(57, 255, 20, 0.6)); /* optional glow */
  transition: all 0.3s;
}

.logo img:hover {
  filter: drop-shadow(0 0 16px rgba(57, 255, 20, 0.9));
  transform: translateY(-2px);
}

/* chart pop up */
#chartModal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    padding: 20px;  /* Gives breathing room on small screens */
    box-sizing: border-box;
}

#chartModal:not(.hidden) {
    display: flex;
}

.modal-content {
    background-color: #0f172a;  /* your dark bg */
    border-radius: 12px;
    width: 95%;                 /* Use almost full width */
    max-width: 1400px;          /* Cap for huge screens */
    max-height: 95vh;           /* Prevent vertical overflow */
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
}

#threeDayChart {
    width: 100% !important;
    height: 100% !important;
    min-height: 600px;          /* Ensures good height */
    flex: 1;                    /* Makes canvas fill available space */
}

/* Optional: make the chart container explicit */
.chart-container {
    width: 100%;
    height: 100%;
    min-height: 600px;
    position: relative;
}

/* Cross hair */
.chart-crosshair-vertical {
    position: absolute;
    width: 1px;
    background-color: rgba(156, 163, 175, 0.6);  /* gray-400 with opacity */
    pointer-events: none;
    z-index: 10;
    top: 0;
    display: none;
}

.chart-crosshair-horizontal {
    position: absolute;
    height: 1px;
    background-color: rgba(156, 163, 175, 0.6);
    pointer-events: none;
    z-index: 10;
    left: 0;
    display: none;
}

/* Price bubble */
.axis-label {
    position: absolute;
    background-color: rgba(15, 23, 42, 0.9);   /* dark slate */
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    z-index: 15;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity 0.1s;
}

#price-bubble {
    right: 12px;
    transform: translateY(-50%);
}

#time-label {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}