/* General body style */
body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
}

/* Header styling */
header {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
}

h1 {
    margin: 0;
    font-size: 24px;
}

main {
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

/* Container styling */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

.input-field {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    border: 2px solid #bdc3c7;
    border-radius: 50px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: #3498db;
    outline: none;
}

.generate-button {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    color: #fff;
    background-color: #3498db;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.generate-button:hover {
    background-color: #2980b9;
}

#auth-forms .form-label,
#news-fetcher .form-label {
    margin-bottom: 8px;
}

/* Form styling */
#news-fetcher {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

#news-fetcher label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

#news-fetcher input {
    width: calc(100% - 22px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 50px;
}

#fetch-button, #summary-button, #download-summary-button {
    background-color: #007bff;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    display: inline-block;
    margin-right: 5px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#fetch-button:hover, #summary-button:hover, #download-summary-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

#fetch-button:active, #summary-button:active, #download-summary-button:active {
    background-color: #004494;
    transform: translateY(1px);
}

#fetch-button, #summary-button, #download-summary-button {
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
}

/* News container styling */
#news-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    margin-top: 20px;
    display: none;  /* Initially hidden */
}

#news-container.collapsed {
    display: none;
}

.news-item {
    border-bottom: 1px solid #ccc;
    padding: 10px 0;
    margin-bottom: 10px;
    transition: box-shadow 0.3s;
}

.news-item:last-child {
    border-bottom: none;
}

.news-item h3 {
    margin: 0;
    font-size: 18px;
}

/* Link styling within news items */
.news-item h3 a.news-link {
    color: inherit;  /* Inherit the color from the parent element */
    text-decoration: none;  /* Remove underline */
}

.news-item h3 a.news-link:hover {
    text-decoration: underline;  /* Underline on hover for better UX */
}

.news-item .source,
.news-item .date-time {
    font-size: 14px;
    color: #666;
}

.news-item .sentiment {
    float: right;
    font-weight: bold;
    margin-left: 10px;
}

.news-item.positive {
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2); /* Light green shadow */
}

.news-item.negative {
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.2); /* Light red shadow */
}

.news-item.neutral {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Light gray shadow */
}

.ticker-display {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

.ticker-symbol {
    font-size: 14px;
    color: #4a90e2;
    margin-right: 5px;
    display: inline-block;
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 5px;
}

/* Summary container styling */
#summary-container pre {
    white-space: pre-wrap;       /* CSS3 */
    white-space: -moz-pre-wrap;  /* Firefox */
    white-space: -pre-wrap;      /* Opera */
    white-space: -o-pre-wrap;    /* Opera */
    word-wrap: break-word;       /* IE */
    display: none;  /* Initially hidden */
}

#summary-container {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    margin-top: 20px;
    display: none;  /* Initially hidden */
}

#summary-container h2, #summary-container h3 {
    margin-top: 20px;
}

#summary-container ul {
    list-style-type: disc;
    padding-left: 20px;
}

/* Sentiment gauge styling */
#sentiment-gauge {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    margin-top: 20px;
    width: 100%;
    height: 200px; /* Increase the height to allow for a thicker bar */
    display: none;  /* Initially hidden */
}

#sentiment-gauge canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

#sentimentChart {
    width: 100%;  /* Ensure the canvas takes full width */
    height: auto;  /* Let height adjust based on content */
}

/* Index quotes styling */
#index-quotes {
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

#index-quotes div {
    text-align: center;
    font-size: 14px;
    color: #333;
}

.positive {
    color: #28a745; /* Green for positive changes */
}

.negative {
    color: #dc3545; /* Red for negative changes */
}

.arrow-up::after {
    content: '▲';
    margin-left: 5px;
}

.arrow-down::after {
    content: '▼';
    margin-left: 5px;
}

.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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

#search-bar {
    width: 100%;
    border-radius: 10px;
    padding: 5px;
    margin-top: 15px;
    position: relative;
}

/* Filters styling */
#filters {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#filters .form-label {
    font-weight: bold;
    color: #495057;
}

#filters .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 16px;
}

/* Toggle news button styling */
#toggle-news-button {
    background-color: #17a2b8; /* Bootstrap info color */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: inline-block;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

#toggle-news-button:hover {
    background-color: #138496; /* Slightly darker shade for hover effect */
}

#stockChart {
    display: block;
    margin: 20px auto;
    width: 80%;  /* Make the chart take 80% of the container's width */
}

#stock-chart-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

#stock-chart-container canvas {
    width: 400px;
    height: 300px;
}

#show-charts {
    margin-bottom: 10px;
}

.chart-container {
    width: 100%;
    height: auto;
    padding: 10px;
    margin: 20px 0;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

canvas {
    max-width: 100%;
    height: auto;
}

.hidden {
    display: none;
}

.rating-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 10px 0;
    }

    main {
        padding: 10px;
    }

    #ticker-input, #news-container, #news-fetcher {
        padding: 15px;
    }

    #news-fetcher {
        padding: 15px;
    }

    #fetch-button, #summary-button, #download-summary-button {
        padding: 12px 20px;
        font-size: 0.9rem;
        margin-bottom: 10px;
        max-width: 100%;
    }

    .news-item h3 {
        font-size: 16px;
    }

    .news-item .source, .news-item .date-time {
        font-size: 12px;
    }

    #index-quotes {
        flex-direction: column;
        align-items: flex-start;
    }

    #index-quotes div {
        margin-bottom: 10px;
    }

    #sentiment-gauge canvas {
        height: auto; 
    }
}

/* For mobile devices */
@media (max-width: 576px) {
    #index-quotes {
        flex-direction: column;
        text-align: center;
    }

    #stock-chart-container {
        flex-direction: column;
        align-items: center;
    }

    .chart-container {
        width: 100%;
        height: auto;
        margin-bottom: 15px;
    }

    canvas {
        width: 100% !important;
        height: auto !important; 
    }


    #sentiment-gauge {
        width: 100%;
        height: auto; 
        margin-bottom: 15px;
    }
}

/* For tablets and up */
@media (min-width: 577px) and (max-width: 768px) {
    #index-quotes {
        flex-direction: row;
        justify-content: space-around;
    }

    #stock-chart-container {
        flex-direction: row;
        justify-content: space-around;
    }
}

/* For desktops and up */
@media (min-width: 769px) {
    #index-quotes {
        justify-content: space-between;
    }

    #stock-chart-container {
        flex-direction: row;
        justify-content: space-between;
    }
}

.noscript {
    width:100%;
    height:100%; /* will cover the text displayed when javascript is enabled*/
    z-index:100000; /* higher than other z-index */
    position:absolute;
 }
 .noscript #div100{
     display:block;
     height:100%;
     background-color:white; 
 }