@media (max-width: 768px) {
    #results {
        width: 100% !important;
        padding: 10px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    #results h2 {
        width: 100%;
        margin: 0;
        padding: 10px 0;
        box-sizing: border-box;
    }

    #results p {
        width: 100%;
        margin: 10px 0;
        padding: 0 15px;
        box-sizing: border-box;
    }
}

/* =========================
   BASE STYLING
   ========================= */
#results {
    text-align: center;
    padding: 20px;
    margin: auto;
    width: 80%;
}

#results h2, #results p {
    margin-bottom: 20px;
}

.button-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 200px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(to bottom, #f9f9f9 0%, #e9e9e9 100%);
    border: 1px solid #ccc;
}

button {
    flex: 1;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: #333;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #dddddd;
}

.button-container button:first-child {
    border-right: 2px solid #ff7b00;
}

/* =========================
   RESULTS CONTAINER
   ========================= */
#resultOutput {
    overflow-y: auto; /* Enables vertical scrolling */
    margin-top: 0px;
    border: 2px solid #ff7b00;
    padding: 0px 15px 15px 15px;
    border-radius: 15px;
    max-height: 0px; /* Initially hidden */
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        inset -3px 0 5px rgba(0, 0, 0, 0.8),
        inset 3px 0 5px rgba(0, 0, 0, 0.8),
        inset -5px 0 0 black,
        inset 5px 0 0 black;
}

#metricsDiv, 
#summarySection, 
#trendSection, 
#weeklySection, 
#yearlySection {
    padding: 5px;
    border-radius: 10px 10px 0 0;
    margin-top: 20px;
    text-align: center;
}

#metricsDiv h3, 
#trendSection h3, 
#weeklySection h3, 
#yearlySection h3 {
    background-color: rgba(255, 123, 0, 0.3);
    padding: 5px;
    border-radius: 10px 10px 0 0;
    margin-top: 20px;
    border-bottom: 2px solid #ff7b00;
    text-align: center;
}

#resultOutput div {
    transition: all 0.3s ease;
}

#resultOutput p {
    margin-top: 20px;
    font-size: 16px;
    line-height: 1.6;
}

/* =========================
   NARRATIVE TEXT BOXES
   ========================= */
#summaryNarrative, 
#trendNarrative, 
#weeklyNarrative, 
#yearlyNarrative {
    text-align: left;
    padding: 10px;
    margin: 10px 0;
    background-color: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.footnote {
    font-size: 0.8em;
    color: #666;
    margin-top: 10px;
}

/* =========================
   NEW METRIC CARD STYLING 
   (MIMICS R RENDER)
   ========================= */
.metric-cards-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Wrap on smaller screens */
}

.metric-card {
    background-color: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 160px;
    text-align: center;
}

.metric-card .value {
    color: #FF7B00;
    font-size: 22px;
    font-weight: bold;
    margin: 0;
}

.metric-card .label {
    font-size: 14px;
    margin-top: 5px;
}