/* earnings_app/static/css/index.css */

body {
    font-family: sans-serif, Arial;
    margin: 0; /* Reset default margin */
    padding: 0 20px; /* Add padding to both left and right */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Set the minimum height to the viewport height */
}

/* Light Mode */
.header {
    text-align: center;
    /*padding: 20px;*/
    padding-top: 20px;
    padding-right: 20px;
    padding-bottom: 0px;
    padding-left: 20px;
    background-color: var(--header-background); /* Light mode background */
    color: var(--text-color); /* Text color */
    border-bottom: 2px solid var(--border-color); /* Add border */
}


.site-title {
    font-size: 2em; /* Refined size */
    font-weight: 600; /* Moderate boldness */
    color: #2F4F4F; /* Sea Green for the text color */
    text-transform: none; /* No uppercase */
    letter-spacing: normal; /* Normal letter spacing */
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif; /* Clean, professional font */

    /* Contour (outline) with Dark Slate Gray */
    text-shadow: 
        -1px -1px 0 #2E8B57, 
         1px -1px 0 #2E8B57, 
        -1px  1px 0 #2E8B57, 
         1px  1px 0 #2E8B57;
}

/* Navigation styles */
.nav-list {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-list li {
    border: 1px solid var(--border-color); /* Light contour */
    border-radius: 5px; /* Match the button's roundness */
    padding: 0;
}

.nav-list li a {
    text-decoration: none;
    color: var(--text-color); /* Default text color */
    padding: 10px 20px; /* Padding inside the link to ensure it matches button size */
    border-radius: 5px; /* Rounded corners to match the active button */
    display: block;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Style for hover effect */
.nav-list li a:hover {
    background-color: var(--secondary-color); /* Background change on hover */
    color: var(--hover-text-color); /* Text color change on hover */
}

/* Active link fully colored */
.nav-list li a.active {
    background-color: var(--primary-color); /* Fully colored background */
    color: var(--active-text-color); /* Text color for active state */
    border-color: var(--primary-color); /* Border matches active background */
    padding: 10px 20px; /* Same padding as regular links */
    border-radius: 5px; /* Same roundness as regular links */
}

/* Dark Mode */
body.dark-mode .nav-list li {
    border-color: var(--border-color); /* Light contour in dark mode */
}

body.dark-mode .nav-list li a.active {
    background-color: var(--primary-color); /* Active link in dark mode */
    color: var(--hover-text-color);
}

main {
    flex: 1; /* This makes the main content area grow to fill available space */
}

.important-stock {
    font-weight: bold;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: var(--footer-background);
    margin-top: 20px;
    color: var(--text-color);
}

/* Calendar Styles */
.calendar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.site-description {
    font-size: 1rem; /* Adjust the font size */
    color: #555; /* A subtle color to complement the main title */
    margin-top: 5px; /* Add some space between the title and description */
    text-align: center; /* Center-align the text if the title is centered */
}

.day {
    padding: 10px;
    background-color: var(--box-background); /* Apply the box background variable */
    border: 1px solid var(--border-color);
    color: var(--text-color);  /* Ensure text color matches the theme */
    transition: background-color 0.3s ease, color 0.3s ease;  /* Smooth transition between themes */
}

/* Dark Mode */
body.dark-mode {
    background-color: #333;
    color: white;
}

body.dark-mode .header {
    background-color: var(--header-background); /* Dark mode background */
    color: var(--text-color); /* Text color */
}

body.dark-mode footer {
    background-color: var(--footer-background); /* Dark mode background */
    color: var(--text-color); /* Text color */
}

/* Variables for Light Theme */
:root {
    --header-background: #f2f2f2;
    --footer-background: #f2f2f2;
    --box-background:#f2f2f2;
    --primary-color: #4CAF50;
    --secondary-color: #ade0ae;
    --active-text-color: #f2f2f2;
    --text-color: #333;
    --border-color: #ccc;
    --hover-text-color: #333;
}

/* Variables for Dark Theme */
body.dark-mode {
    --header-background: #444;
    --footer-background: #444;
    --box-background:#f2f2f2;
    --primary-color: #FF6F61;
    --secondary-color: #FF8C42;
    --text-color: #f0f0f0;
    --hover-text-color: #333;
}

/* Fade out effect */
.fade-out {
    opacity: 0;
    transition: opacity 0.7s ease;
}

/* Fade in effect */
body {
    opacity: 1;
    transition: opacity 0.7s ease;
}

/* Style the theme toggle button */
.theme-toggle {
    position: absolute;
    top: 10px;
    right: 20px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    color: var(--text-color);
    padding: 5px 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Change color based on theme */
body.light-mode .theme-toggle {
    color: #333; /* Light mode icon color */
}

body.dark-mode .theme-toggle {
    color: #f0f0f0; /* Dark mode icon color */
}

body.dark-mode .theme-toggle {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
} 

/* Basic table styling */
#earnings-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#earnings-table th, #earnings-table td {
    padding: 5px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

/* Column headers */
#earnings-table th {
    vertical-align: bottom;
    cursor: pointer;
    background-color: #f4f4f4;
}

/* Hover effect on headers */
#earnings-table th:hover {
    background-color: #e9e9e9;
}

/* Alternating row colors */
#earnings-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

/* Sorting indicators */
.sort-indicator {
    margin-left: 5px;
    font-size: 0.8em;
}

.sort-indicator.asc::after {
    content: '▲';
}

.sort-indicator.desc::after {
    content: '▼';
}

/* Limit the text width for a more elegant look */
.about-container {
    max-width: 800px; /* 6 inches wide on most screens */
    margin: 0 auto;
    padding: 20px;
}

/* In-page navigation styling */
.about-nav {
    margin-bottom: 20px;
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section {
    margin-bottom: 20px;
    width: 600px;
    padding-left: 100px;
    padding-right: 100px;
}

.about-nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: space-around;
}

.about-nav ul li {
    margin: 0 10px;
}

.about-nav ul li a {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

.about-nav ul li a:hover {
    text-decoration: underline;
}

/* Section styling */
section {
    margin-top: 20px;
}

section h1, section h2 {
    margin-bottom: 10px;
    font-family: 'Arial', sans-serif;
    color: #333;
}

/* Text styling */
.about-container p {
    line-height: 1.6;
    color: #555;
}

/* Add some space between sections */
section {
    margin-bottom: 20px;
}

/* Form Elements */

/* Label Styles */
label {
    display: block; /* Make labels block-level to ensure they are above the input */
    margin-bottom: 5px; /* Small spacing between label and input */
    font-weight: bold; /* Bold for emphasis */
    color: var(--text-color); /* Use theme text color */
    font-size: 1rem; /* Match general font size */
}

/* Text Field Styles */
input[type="text"],
input[type="date"],
select {
    width: 100%; /* Full width */
    padding: 10px; /* Padding inside the input */
    margin-bottom: 15px; /* Space between input fields */
    border: 1px solid var(--border-color); /* Use border color from the theme */
    border-radius: 5px; /* Rounded corners to match buttons */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    font-size: 1rem; /* Match the font size */
    background-color: var(--box-background); /* Use background color from the theme */
    color: var(--text-color); /* Use text color from the theme */
    transition: border-color 0.3s ease, background-color 0.3s ease; /* Smooth transitions */
}

/* Focus State for Inputs */
input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
    border-color: var(--primary-color); /* Highlight border on focus */
    outline: none; /* Remove the default outline */
}

/* Flexbox container to align items in a single row */
#button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Button Styles */
button,
.nav-button {
    background-color: var(--primary-color); /* Use the primary color for buttons */
    color: var(--active-text-color); /* Use the active text color */
    padding: 10px 20px; /* Padding for the button */
    border: none; /* Remove default border */
    border-radius: 5px; /* Rounded corners to match the header buttons */
    font-size: 1rem; /* Match the general font size */
    cursor: pointer; /* Pointer cursor on hover */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transitions */
    margin-right: 5px; /* Spacing between buttons */
}

/* Button Hover Effect */
button:hover,
.nav-button:hover {
    background-color: var(--secondary-color); /* Change to secondary color on hover */
    color: var(--hover-text-color); /* Use hover text color */
}

/* Active Button Style */
button.active {
    background-color: var(--active-bg-color); /* Use active background color */
    color: var(--active-text-color); /* Active text color */
}

/* Remove margins for headings to align buttons in a single line */
#date-range-buttons h3,
#zscore-buttons h3 {
    margin: 0;
    margin-right: 10px;
    display: inline-block;
    vertical-align: middle;
}

/* Flexbox for date range buttons to be inline */
#date-range-buttons,
#zscore-buttons {
    display: flex;
    align-items: center;
}

/* Container for the filters */
.filter-container {
    display: flex;
    align-items: center; /* Vertically center items */
    gap: 15px; /* Space between elements */
    margin-bottom: 20px; /* Space below the filters */
    flex-wrap: wrap; /* Allows wrapping to a new line if the screen is too narrow */
}

/* Ensure each filter group stays together */
.filter-group {
    display: flex;
    align-items: center; /* Center items vertically within the group */
    gap: 5px; /* Space between the label and input/select */
}

/* Adjust input and select element sizes */
.filter-container input[type="date"],
.filter-container select {
    padding: 5px; /* Padding for better appearance */
    font-size: 1em; /* Font size */
    min-width: 150px; /* Minimum width for all select elements */
    max-width: 200px; /* Maximum width to prevent overflow */
}

/* Style the individual filter elements */
.filter-container label {
    margin-right: 5px; /* Space between the label and input */
}

/* Style the clear button */
.filter-container button {
    padding: 5px 10px; /* Padding for the button */
    font-size: 1em; /* Font size */
    cursor: pointer; /* Pointer cursor on hover */
}

/* Form Styles */
form {
    max-width: 600px; /* Limit the form width */
    margin: 0 auto; /* Center the form horizontally */
}

/* Align the submit button in the form */
form button {
    display: inline-block;
    width: auto; /* Adjust to fit the content */
}

.terminal-panel {
    background-color: var(--panel-bg-color); /* Background color for light/dark mode */
    color: var(--text-color); /* Text color for light/dark mode */
    font-family: sans-serif, Arial; /* Sans-serif font */
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    border: 2px solid var(--border-color); /* Border color for light/dark mode */
    width: 100%; /* Full width like the earnings table */
    font-size: 1em; /* Adjust font size to match earnings table */
    box-sizing: border-box; /* Include padding and border in the element's total width */
}

/* Header styling */
.terminal-panel h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* List styling */
.terminal-panel ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.terminal-panel li {
    margin: 4px 0;
}

/* Styling for Z-Scores section */
.terminal-panel h3 {
    display: inline-block; /* Keep Z-Scores and '?' on the same line */
    margin: 0;
    font-size: 1.2em; /* Slightly larger than the regular text */
}

.terminal-panel .label {
    display: inline-block; /* Align labels inline with their content */
    margin-right: 5px; /* Small space between label and content */
}

.terminal-panel a {
    text-decoration: none; /* Remove underline from '?' link */
    margin-left: 5px; /* Space between label and '?' */
    vertical-align: middle; /* Align the '?' icon with the label */
    font-size: 1em; /* Adjust size of the '?' to match the label */
    color: var(--text-color); /* Use the same text color for light/dark mode */
}

.terminal-panel .value {
    margin-left: 10px; /* Space between label and value */
    font-weight: bold; /* Make values stand out */
}

/* Table styling */
.terminal-panel .price-grid .fundamentals-table {
    width: 100%;
    border-collapse: collapse; /* Match earnings-table */
    margin-top: 20px; /* Add space between list and table */
}

.terminal-panel .price-grid .fundamentals-table th,
.terminal-panel .price-grid .fundamentals-table td {
    border-bottom: 1px solid var(--border-color); /* Similar border style as earnings table */
    padding: 10px; /* Adjust padding to match earnings table */
    text-align: left;
}

.terminal-panel .price-grid .fundamentals-table th {
    cursor: pointer;
    background-color: var(--header-bg-color); /* Light/dark mode background */
}

.terminal-panel .price-grid .fundamentals-table th:hover {
    background-color: var(--header-hover-bg-color); /* Hover effect for light/dark mode */
}

.terminal-panel .price-grid .fundamentals-table tr:nth-child(odd) {
    background-color: var(--row-odd-bg-color); /* Alternating row colors for light/dark mode */
}

.terminal-panel .price-grid .fundamentals-table td {
    background-color: var(--panel-bg-color); /* Same background as the panel */
}

/* CSS Variables for Light/Dark Mode */
:root {
    /* Light mode colors */
    --panel-bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #ddd;
    --header-bg-color: #f4f4f4;
    --header-hover-bg-color: #e9e9e9;
    --row-odd-bg-color: #f9f9f9;
}

[data-theme="dark"] {
    /* Dark mode colors */
    --panel-bg-color: #1c1c1c;
    --text-color: #00ff00;
    --border-color: #00ff00;
    --header-bg-color: #2c2c2c;
    --header-hover-bg-color: #3c3c3c;
    --row-odd-bg-color: #2c2c2c;
}


.terminal-panel .label {
    display: inline-block;
    width: 50%;
}

.terminal-panel .value {
    display: inline-block;
    width: 30%;
    text-align: right;
}

.terminal-panel .price-grid .fundamentals-table tr:nth-child(even) {
    background-color: #2c2c2c; /* Alternating background for rows */
}

.terminal-panel .price-grid .fundamentals-table .performance-result {
    text-align: center; /* Center align for performance column */
}

/*.fundamentals-table .performance-result th:first-child,*/
.fundamentals-table .performance-result td:first-child {
    text-align: left;
}

/* Align the second and third columns to the right */
/*.fundamentals-table .performance-result th:nth-child(2),*/
/*.fundamentals-table .performance-result th:nth-child(3),*/
.fundamentals-table .performance-result td:nth-child(2),
.fundamentals-table .performance-result td:nth-child(3),
.fundamentals-table .performance-result td:nth-child(4),
.fundamentals-table .performance-result td:nth-child(5)  {
    text-align: right;
}

.price-grid td {
    text-align: left;
}

.price-grid th, 
.price-grid td {
    padding: 2px 7px; /* 10px top and bottom, 7px left and right */
}

/* Align numeric columns (2nd, 3rd, 4th, and 5th) to the right */
.price-grid td:nth-child(2),
.price-grid td:nth-child(3),
.price-grid td:nth-child(4),
.price-grid td:nth-child(5) {
    text-align: right;
}

#date-range-buttons button,
#date-range-buttons .nav-button {
    background-color: var(--body-bg-color); /* Use body background color */
    color: var(--primary-text-color); /* Use a text color that contrasts with body background */
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin-right: 5px;
}


/* Active Button Style for date range buttons */
#date-range-buttons button.active {
    /*background-color: var(--active-bg-color); /* Use active background color */
    /*color: var(--active-text-color); /* Active text color */
    background-color: var(--primary-color); /* Use the primary color for buttons */
    color: var(--active-text-color); /* Use the active text color */
    border: 2px solid var(--secondary-color); /* Add a border to highlight the button */
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); /* Add a subtle shadow for a raised effect */
    font-weight: bold;
}

/* Button Hover Effect for date range buttons */
#date-range-buttons button:hover,
#date-range-buttons .nav-button:hover {
    background-color: var(--secondary-color); /* Change to secondary color on hover */
    color: var(--hover-text-color); /* Use hover text color */
}

/* Links panel styling */
.links-panel {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    background-color: #f9f9f9;
    margin-top: 20px;
}

/* Styling for the list of links */
#external-links-list {
    list-style-type: none;
    padding: 0;
    margin: 10px 0;
}

/* Styling for individual links */
#external-links-list li {
    margin: 5px 0;
    font-size: 16px;
}

/* Custom link styling */
#external-links-list a {
    color: #007BFF;
    text-decoration: none;
    font-weight: bold;
}

/* Hover effect for links */
#external-links-list a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Styling for the external link icon */
.external-link-icon {
    font-size: 0.9em;
    margin-left: 5px;
    color: #555;
}

/* Style the question mark icon */
.info-icon {
    background-color: #d4f8e8; /* Very light green */
    color: red; /* Red color for the question mark */
    padding: 5px 10px; /* Add padding for a button-like appearance */
    border-radius: 5px; /* Rounded corners */
    cursor: pointer; /* Show pointer cursor on hover */
    display: inline-block; /* Ensure it's treated as an inline block */
    text-align: center;
    font-size: 20px; /* Adjust font size */
    margin-left: 5px; /* Add some spacing around the icon */
}

/* Add hover effect to indicate it's clickable */
.info-icon:hover {
    background-color: #b8f0d2; /* Slightly darker green on hover */
}

.info-popup {
    position: fixed; /* Fixed positioning to center the popup */
    top: 50%; /* Vertically center */
    left: 50%; /* Horizontally center */
    transform: translate(-50%, -50%); /* Offset by 50% to center */
    background-color: #f9f9f9;
    border: 2px solid red; /* Red border */
    padding: 20px;
    border-radius: 10px;
    font-size: 24px; /* Large font size */
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2); /* Optional: Add a shadow */
    z-index: 1000; /* Ensure it appears above other elements */
    max-width: 80%; /* Limit the popup width */
    text-align: center;
}

/* ETF Banner */
#etf-banner-container {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 0; /* Remove padding */
    border-bottom: 1px solid #444;
    position: relative;
    width: 100%; /* Full-width */
    margin: 0; /* Remove margins */
}

#etf-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    width: 100%; /* Full-width */
}

/* Scrolling Ticker */
#etf-ticker {
    display: flex;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-content {
    display: inline-flex;
    animation: ticker-scroll 60s linear infinite; /* Adjust duration for slower speed */
    width: auto; /* Dynamic width */
}

/* Keyframes for scrolling animation */
@keyframes ticker-scroll {
    0% {
        transform: translateX(30%); /* Start slightly outside the viewport */
    }
    100% {
        transform: translateX(-100%); /* Move content completely off the left side */
    }
}

/* Styling for ticker items */
.etf-info {
    display: inline-block;
    padding: 0 20px;
    min-width: fit-content;
    color: #ffffff; /* Ensure text color is visible */
}

#expand-arrow, #play-pause {
    cursor: pointer;
    font-size: 1.5rem;
    padding-left: 10px;
    color: #ffffff; /* Ensure text color is visible */
}

#etf-details {
    background-color: #1c1c1c;
    padding: 20px;
    display: none; /* Default to hidden */
    position: absolute;
    top: 100%; /* Place it below the banner */
    left: 0;
    right: 0;
}

#etf-details.hidden {
    display: none; /* Hide when the 'hidden' class is added */
}

#etf-details:not(.hidden) {
    display: block; /* Show when the 'hidden' class is removed */
}

.etf-details-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
}

.etf-detail {
    background-color: #444;
    padding: 10px;
    margin: 10px;
    width: 200px;
    border-radius: 5px;
}

/* Positive and Negative Changes */
.up {
    color: #5bee60; /* Green for positive change */
}

.down {
    color: #ff3a2c; /* Red for negative change */
}

.up-strong {
    color: #0b8d10; 
}

.down-strong {
    color: #8e1f17; 
}

.neutral {
    color: var(--text-color); /* Black for relatively the same */
}

.very-high-risk {
    color: #ff0000; /* Red for very high risk */
}

.high-risk {
    color: #ff4500; /* Orange for high risk */
}

.moderate-risk {
    color: #ffa500; /* Amber for moderate risk */
}

.low-risk {
    color: #008000; /* Green for low risk */
}

#histograms-wrapper {
    display: flex;  /* Use flexbox to align items in a row */
    justify-content: space-between;  /* Optional: add space between the histograms */
    margin-top: 20px;
}

#histogram-container, #histogram-container2 {
    width: 50%;  /* Each container takes up half the available width */
    padding: 10px;
}

canvas {
    width: 100%;  /* Make sure the canvas takes up the full width of its container */
    height: auto;  /* Auto height to maintain aspect ratio */
}

.red-text {
    color: red;
    font-weight: bold;
}

.red-background {
    background-color: red;
    color: white;
    font-weight: bold;
}

.beta-label {
    display: inline-block;
    padding: 2px 3px;
    border: 5px solid #0a610b; /* Adjust the color to your preference */
    border-radius: 4px; /* Add a slight rounding, or set to 0 for sharp edges */
    font-size: 0.6em; /* Make the text a bit smaller */
    font-weight: lighter;
    margin-left: 5px; /* Space between "TheCrazyEarnings" and "beta" */
    position: relative;
    top: -3px;
}

.cta-link {
    color: #3498db;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease; /* Smooth color transition */
}

.cta-link:hover {
    color: #1abc9c; /* Hover color */
}
