﻿/* Freemium Utility Class */
.premium-locked {
    position: relative !important; /* Ensure absolute positioning works for the lock */
    opacity: 0.6;
    filter: grayscale(80%);
    cursor: not-allowed !important;
    /* Do NOT use pointer-events: none; here, so we can still intercept clicks! */
}

/* The Lock Icon */
.premium-locked::after {
    content: "🔒";
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    font-size: 0.875rem;
    background: #ffffff;
    border: 0.0625rem solid #ccc;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.2);
    z-index: 10;
}

/* Specific fix for inputs/labels so the click registers on the wrapper */
.premium-locked input, 
.premium-locked select, 
.premium-locked button {
    pointer-events: none; 
}

/* ----------------------------------------------- HEADER --------------------------------------------- */

/* Reset default margin and padding */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Style the header */
header {
    background-color: #333;
    height: 5rem;
}

/* Style the navigation */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 2.5%;
    flex-wrap: nowrap;
}

/* Style the logo */
.logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    color: orange;
    font-size: 1.5em; /*1.5rem;*/
    margin-left: 3.125rem;
}


.logo-text {
    font-size: 1em; /* Adjust size as needed */
    font-weight: bold; /* Make it stand out */
    color: #00bcd4; /* Vibrant cyan */
    text-transform: uppercase; /* Sleek and professional */
    letter-spacing: 0.09375rem; /* Spaced out for a modern feel */
    margin-left: 0.5rem; /* Space between logo image and text */
    font-family: 'Arial', sans-serif; /* Clean, professional font */
    background: linear-gradient(to right, #00bcd4, #43ecff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0rem 0rem 0.5rem rgba(0, 188, 212, 0.6); /* Cyan glow */
}

/* Style the search box wrapper */
.search-box {
    display: none;
    position: relative; /* Crucial for dropdown positioning */
    flex: 1;
    max-width: 25rem;
    margin: 0 1.25rem;
    transition: opacity 0.4s ease-out, visibility 0s linear 0.4s;
}

/* Search input container - acts as the single visual box */
.search_input-container {
    display: flex;
    align-items: center;
    width: 100%;
    background: #ffffff;
    border: 0.0625rem solid #cbd5e1;
    border-radius: 1.25rem;
    transition: all 0.2s ease;
    box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.05);
}

/* Professional Focus Ring */
.search-box:focus-within .search_input-container {
    border-color: #00bcd4;
    box-shadow: 0 0 0 0.1875rem rgba(0, 188, 212, 0.15);
}

/* The actual text input */
.search_input-container input[type="text"] {
    flex: 1;
    height: 2.5rem;
    padding: 0 1rem;
    border: none;
    background: transparent;
    font-size: 1.25em;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: #334155;
    outline: none;
}

.search_input-container input::placeholder {
    color: #94a3b8;
}

/* Clear button inside search bar */
.clear-search {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    color: #cbd5e1;
    padding: 0.25rem 0.75rem;
    display: none;
    transition: color 0.2s;
}

.clear-search:hover {
    color: #64748b;
}

.search_input:focus ~ .clear-search,
.search_input:not(:placeholder-shown) ~ .clear-search {
    display: block;
}

/* Search results container */
.search_results-container {
    position: absolute;
    top: calc(100% + 0.5rem); /* Creates a clean gap below the search bar */
    left: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 0.5rem;
    border: 0.0625rem solid #e2e8f0;
    box-shadow: 0 0.625rem 1.5625rem -0.3125rem rgba(0, 0, 0, 0.1), 0 0.5rem 0.625rem -0.375rem rgba(0, 0, 0, 0.1);
    max-height: 18.75rem;
    overflow-y: auto;
    display: none;
    z-index: 2010;
}

.search_results-container--visible {
    display: block;
    animation: fadeInMenu 0.2s ease-out forwards;
}

/* Individual search result items */
.search_result {
    display: block;
    padding: 0.75rem 1rem;
    color: #475569;
    text-decoration: none;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-weight: 500;
    font-size: 1.25em;
    border-bottom: 0.0625rem solid #f1f5f9;
    border-left: 0.1875rem solid transparent; /* Prep for hover animation */
    transition: all 0.2s ease;
    cursor: pointer;
}

.search_result:last-of-type {
    border-bottom: none;
}

/* Professional, subtle hover effect */
.search_result:hover {
    background-color: #f8fafc;
    color: #0f172a;
    padding-left: 1.25rem; /* Slight indent for a premium tactile feel */
    border-left: 0.1875rem solid #00bcd4; /* Subtle cyan accent indicator */
}


.end-container {
    align-items: center;
    justify-content: flex-end;
    display: flex;
    flex-direction: row;
}

/* Style the login button */
.login-btn {
    background: linear-gradient(135deg, #ffd700, #ffcc00); /* Gold gradient */
    color: #8b6508; /* Deep golden color for text */
    font-weight: bold;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border: 0.125rem solid #b8860b; /* Darker gold border */
    border-radius: 1.875rem; /* More rounded for a premium feel */
    cursor: pointer;
    margin-left: 0.625rem;
    box-shadow: 0 0.25rem 0.625rem rgba(255, 215, 0, 0.5); /* Soft gold glow */
    text-transform: uppercase; /* More premium look */
    letter-spacing: 0.0625rem;
    transition: all 0.3s ease-in-out;
}

    .login-btn:hover {
        background: linear-gradient(135deg, #ffcc00, #ffb700);
        color: #654321; /* Darker gold on hover */
        box-shadow: 0 0.375rem 0.9375rem rgba(255, 215, 0, 0.8);
        transform: scale(1.05);
    }

    .login-btn:active {
        transform: scale(0.98);
        box-shadow: 0 0.125rem 0.3125rem rgba(255, 215, 0, 0.5);
    }

    /* --- Location Dropdown --- */
.location-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.location-dropdown {
    display: none;
    flex-direction: column;
    background: #fdfdfd;
    border-left: 0.125rem solid #00bcd4;
    margin-left: 0.9375rem;
}

.location-dropdown a {
    padding: 0.5rem 1rem !important;
    font-size: 0.8125rem !important;
    color: #555 !important;
}

.location-dropdown a:hover {
    background: #f1f1f1 !important;
    color: #00bcd4 !important;
    font-weight: bold;
}




    /* ----------------------------------------------- MAIN --------------------------------------------- */

main, footer {
    margin: 0 auto;
    padding: 0% 1%;
    font-size: 1rem;
}

/* --- Global Options Container --- */
.global-opt-container {
    position: relative;
    display: flex;
}

/* --- SAVE/LOAD TABS --- */
.action-tab-btn {
    padding: 0rem 0.875rem;
    cursor: pointer;
    background: linear-gradient(135deg, #fefefe, #e8e8e8);
    border: 0.0625rem solid #dcdcdc;
    border-bottom: none;
    border-radius: 0.625rem 0.625rem 0 0;
    font-family: 'Arial', sans-serif;
    font-size: 1.625em;
    font-weight: bold;
    color: #333;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
    transition: all 0.25s ease-in-out;
    display: flex;
    align-items: center;
}

.action-tab-btn:hover {
    background: #e0e0e0;
    color: #000;
}

.stock-info-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 1em;
    /*border: 0.125em solid #ddd;*/
    border-radius: 0.5em;
    box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.1);
    background-color: #fff;
    max-width: 100em;
    margin: 1em auto;
}

.chart-Info-All {
    display: flex;
    align-items: flex-start;
    width: 100%;
    background-color: #fff;
}

/* Fix Canvas Sizing */
.chart-Info-Main {
    width: 100%;
    position: relative; /* Required for Chart.js responsiveness */
}

.chart-Info-Input-Small-Label {
    font-family: 'Arial', sans-serif;
    color: #666;
    font-weight: bold;
    margin-bottom: 0.125rem;
    padding-left: 0.125rem;
}

.stock-canvas-container {
    width: 100%;
    height: 25rem; /* Fixed height ensures it displays properly */
    position: relative;
    margin-top: 0.3125rem;
}

/* Time Buttons & Checkbox Controls */
.stock-chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 0.625rem 0.9375rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid #ddd;
}

.time-buttons button {
    background: white;
    border: 0.0625rem solid #ccc;
    padding: 0.375rem 0.75rem;
    margin-right: 0.3125rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    transition: all 0.2s ease;
}

.time-buttons button:hover {
    background: #00bcd4;
    color: white;
    border-color: #00bcd4;
}

.ma-checkbox label {
    font-weight: bold;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Currency Badge Styling --- */
.currency-badge {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    background: linear-gradient(135deg, #a8cfd4, #7e9194);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.25em 0.6em;
    border-radius: 0.375rem;
    margin: 0 0.5rem;
    /* vertical-align: middle; */
    box-shadow: 0 0.125rem 0.3125rem rgba(0, 187, 212, 0.185);
    border: 0.0625rem solid rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
}

.balance-sheet-title .currency-badge {
    transform: translateY(-0.25rem); /* Slight lift to align with text */
}

.chart-Info-Right {
    display: flex;
    width: 50%;
    flex-direction: column;
}

.chart-Info-Balance-Sheet {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.chart-Info-Assets, .chart-Info-Liab {
    display: flex;
    flex-direction: column;
    width: 50%;
    padding: 0.9375rem;
    border-radius: 0.625rem;
    background: #ffffff;
    box-shadow: 0.125rem 0.125rem 0.625rem rgba(0, 0, 0, 0.05);
}

.balance-sheet-title {
    text-align: center;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 1.25rem;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.125rem;
    border-bottom: 0.1875rem solid #00bcd4;
    padding-bottom: 0.75rem;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    margin: 0.25rem 0;
    border-radius: 0.3125rem;
}

.main-highlight {
    font-weight: bold;
    background: rgba(175, 175, 175, 0.2);
    color: #333;
}

.subdued {
    font-weight: normal;
    color: #6c757d;
    background: rgba(200, 200, 200, 0.05); /* Made slightly lighter than main */
}

.label {
    text-align: left;
    /* Optional: Add a subtle dot leader or keep it clean */
}

.value {
    text-align: right;
    font-weight: 600;
}

.chart-Info-Left {
    display: flex;
    flex-direction: column;
    width: 50%;
    /*border: 0.125em solid rgba(100, 100, 100, 0.8);*/
}

.chart-Info-Left-Header {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.chart-Info-Naming, .chart-Info-Input-Container, .control-elements-container, .chart-Info-Value-Only, .chart-Info-Trackbar {
    border-radius: 1rem;
    background: linear-gradient(135deg, #ffffff, #f8f8f8);
    border: 0.0625rem solid #dcdcdc;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease-in-out;
    font-family: Arial, sans-serif;
}

.chart-Info-Naming {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Added vertical centering */
    width: 100%; 
    flex-grow: 1; /* Instructs it to fill all newly available stretched height */
}

.chart-Info-Value, .chart-Info-Inside-Header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%; 
    margin: 0 auto;
    flex: 1; /* Added to evenly share 50/50 horizontal space */
}

.chart-Info-Value-Only {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center; /* Added vertical centering */
    gap: 0.625rem;
    padding: 1.25rem;
    flex-grow: 1; /* Instructs it to fill all newly available stretched height */
}

.chart-Info-Trackbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.625rem;
    padding: 1.25rem;
}

/* Define the custom angle property for the animation */
@property --border-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

/* --- Enhanced Base Button --- */
.value-calc-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem; 
    height: 3rem;
    padding: 0;
    font-size: 1.4rem;
    
    /* We use transparent borders and background-clip to allow the border gradient to show */
    border: 0.125rem solid transparent; 
    border-radius: 0.75rem; 
    background: 
        linear-gradient(145deg, #ffffff, #f8fafc) padding-box,
        linear-gradient(145deg, #cbd5e1, #cbd5e1) border-box;
        
    color: #94a3b8; 
    cursor: pointer;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04), inset 0 -0.125rem 0.25rem rgba(0,0,0,0.02);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- Smooth Hover State (Inactive) --- */
.value-calc-button:hover:not(.active-glow) {
    background: 
        linear-gradient(145deg, #f8fafc, #f1f5f9) padding-box,
        linear-gradient(145deg, #94a3b8, #94a3b8) border-box;
    color: #64748b;
    transform: translateY(-0.125rem);
    box-shadow: 0 0.375rem 0.75rem rgba(0, 0, 0, 0.06);
}

/* --- Active State: One-Time Circling Rainbow --- */
.value-calc-button.active-glow {
    color: #00bcd4; /* Lights up the icon */
    transform: translateY(0) scale(1.05); /* Satisfying physical pop */
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.3); /* Subtle, static outer glow */
    
    /* The conic gradient creates the sweeping rainbow, rotating via var(--border-angle) */
    background: 
        linear-gradient(135deg, #e0f7fa, #cff4f9) padding-box,
        conic-gradient(from var(--border-angle), #00bcd4, #a855f7, #ec4899, #eab308, #22c55e, #00bcd4) border-box;
        
    /* Plays exactly once, slowing down smoothly at the end (forwards keeps it at 360deg when done) */
    animation: circle-border 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* --- The Rotation Keyframes --- */
@keyframes circle-border {
    0% { --border-angle: 0deg; }
    100% { --border-angle: 360deg; }
}

/* --- Full Stretching Button --- */
.toggle-panel-btn {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.9375rem;
    background: linear-gradient(135deg, #ffffff, #c3dde0);
    border: 0.0625rem solid #000000;
    border-radius: 0.5rem;
    font-size: 0.75em;
    font-weight: bold;
    color: #273436;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
}

.toggle-panel-btn:hover {
    background: linear-gradient(135deg, #ffffff, #aabfc2);
    color: #000000;
}

.radio-input {
    display: none;
}

.radio-label {
    position: relative;
    padding-left: 1.75rem;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    user-select: none;
    transition: color 0.3s ease;
}

    .radio-label::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        width: 0.625rem;
        height: 0.625rem;
        transform: translateY(-50%);
        border: 0.125rem solid #000;
        border-radius: 50%;
        background: linear-gradient(145deg, #f5f5f5, #e0e0e0);
        box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.1);
    }

/* Animated inner dot */
.radio-input:checked + .radio-label::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.4375rem;
    width: 0.625rem;
    height: 0.625rem;
    background: linear-gradient(145deg, #c2ffb6, #007a11);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: dotFadeIn 0.2s ease-out forwards;
}

/* Define the animation */
@keyframes dotFadeIn {
    0% {
        transform: translate(-50%, -50%) scale(0.4);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Optional hover effect */
.radio-label:hover::before {
    border-color: #666;
}

.add-button.new-chart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 1.25rem auto;
    padding: 1rem;
    max-width: 50rem; /* Wider, more proportional to the data charts */
    background-color: #f8fafc;
    border: 0.125rem dashed #cbd5e1;
    border-radius: 0.75rem;
    color: #64748b;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none; /* override previous generic shadow */
}

.add-button.new-chart:hover {
    background-color: #f0fdfa;
    border-color: #00bcd4;
    color: #00bcd4;
    transform: translateY(-0.125rem);
    box-shadow: 0 0.375rem 1rem rgba(0, 188, 212, 0.15);
}

.add-button.new-chart:active {
    transform: translateY(0);
    background-color: #e2e8f0;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 188, 212, 0.1);
}

.chart-Info-Input-Container {
    display: flex;
    flex-direction: column;
    gap: 0.9375rem;
    padding: 1.5rem;
}

.chart-Info-Input-Label {
    font-family: 'Arial', sans-serif;
    font-weight: bold;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
    margin-bottom: 0.25rem;
}

.radio-container-extra {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
}

.chart-Info-Input {
    padding: 0.625rem 0.875rem;
    font-family: 'Arial', sans-serif;
    border: 0.125rem solid #ccc;
    border-radius: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    background-color: #fff;
    transition: all 0.25s ease;
}

    .chart-Info-Input:focus {
        border-color: #00bcd4;
        box-shadow: 0 0 0 0.25rem rgba(0, 188, 212, 0.15);
        outline: none;
    }

.value-calc-container {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    align-items: center;
}

/* Base container adjustment */
.value-header-container {
    width: 100%;
    margin: 0;
}

/* 1. The Title Label (e.g., "VALUE [BADGE]") */
.value-header-container:nth-of-type(2) .value-label {
    font-family: 'Arial', sans-serif;
    font-size: 1.5em;
    font-weight: 800;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.15625rem;
    margin-bottom: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 2. The Actual Number Label (e.g., "125.5") */
.value-header-container:nth-of-type(3) .value-label {
    font-family: 'Arial', sans-serif;
    font-size: 3.5em; /* Makes the final result massive and undeniable */
    font-weight: 900;
    background: linear-gradient(135deg, #00bcd4, #007a91);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0rem 0.375rem 0.9375rem rgba(0, 188, 212, 0.3); /* Soft cyan glow */
    margin: 0.3125rem 0 0.625rem 0;
    letter-spacing: -0.0625rem;
    text-align: center;
}

.trackbar-container {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
}

.trackbar {
    width: 100%;
    -webkit-appearance: none;
    height: 0.375rem;
    border-radius: 0.3125rem;
    background: #ddd;
    outline: none;
    transition: background 0.3s;
}

    .trackbar:hover {
        background: #ccc;
    }

    .trackbar::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 0.875rem;
        height: 0.875rem;
        border-radius: 50%;
        background: #007bff;
        cursor: pointer;
        transition: background 0.3s;
    }

        .trackbar::-webkit-slider-thumb:hover {
            background: #0056b3;
        }

.trackbar-value {
    font-weight: bold;
    color: #555;
    margin-left: 0.625rem;
}

.chart-Info-Main {
    width: 100%;
    /*border: 0.125em solid #ed1818;*/
    /*aspect-ratio: 32 / 4;*/
}

.stock-chart {
}

.chart-Info-Label-Name {
    font-size: 2em;
    font-weight: 700;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.75);
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    display: inline-block;
    white-space: nowrap;
    text-shadow: 0.0625rem 0.0625rem 0.1875rem rgba(0, 0, 0, 0.5);
    box-shadow: 0 0.1875rem 0.625rem rgba(0, 0, 0, 0.3);
    text-align: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* --- UNIFIED PRICE BADGE WRAPPER --- */
.price-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #ffffff, #f8fcff);
    border: 0.0625rem solid #cbd5e1;
    padding: 0.5rem 0.875rem;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.625rem rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* --- MAIN PRICE --- */
.chart-Info-Label-Price {
    font-size: 1.5em;
    font-weight: 800;
    color: #0f172a; /* Deep premium slate instead of harsh pure black */
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none; 
    border: none;
    text-shadow: none; /* Removes the old washed-out white glow */
    letter-spacing: -0.03125rem;
    display: inline-flex;
    align-items: center;
}

/* --- CONVERTED PRICE --- */
.chart-Info-Label-Converted {
    font-size: 1.5em;
    font-weight: 600;
    color: #8796aabd; /* Subdued gray to establish hierarchy */
    margin: 0;
    padding: 0;
    padding-top: 0.5rem;
    border-top: 0.125rem solid #e2e8f0; /* Clean vertical divider */
    display: inline-flex;
    align-items: center;
}

.chart-Info-Label-Converted .currency-badge {
    transform: translateY(-0.25rem); /* Slight lift to align with text */
}

.chart-Info-Label {
    display: inline-block;
    background-color: #f1f3f5; 
    color: #222;
    font-weight: 700; 
    letter-spacing: 0.03125rem; 
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem; 
    border: 0.125rem solid #ccc; 
    box-shadow: 0 0.1875rem 0.375rem rgba(0, 0, 0, 0.15); 
    text-align: center;
    white-space: nowrap;
}

.chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 0.5em;
    box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.1);
    background-color: #fff;
    width: 100%;
    max-width: 100em;
    margin: 1em auto;
}

.chart-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Naturally pushes content to opposite ends */
    width: 100%;
    background: #f8f9fa;
    padding: 0.625rem 0.625rem;
    border-radius: 0.75rem;
    border: 0.0625rem solid #e2e8f0;
    box-shadow: 0 0.25rem 0.9375rem rgba(0, 0, 0, 0.03), 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    gap: 1rem;
    box-sizing: border-box;
    flex-wrap: nowrap; /* Allows inner items to wrap cleanly */
    transition: all 0.3s ease;
}

.chart-select-container {
    display: flex;
    flex-direction: column;
}

.chart-metrics-toolbar {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 0.625rem;
    box-shadow: 0 0.25rem 0.9375rem rgba(0, 0, 0, 0.03), 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05);
    padding: 0.625rem 0rem;
    gap: 0.75rem;
}

.chart-only-select-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.operation-only-select-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.add-button {
    font-size: 1.25em;
    font-weight: bold;
    text-align: center;
    color: #989898;
    background-color: rgba(200, 200, 200, 0.3);
    border: 0.125em solid rgba(150, 150, 150, 0.5);
    border-radius: 0.5em;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: 0em 0.125em 0.375em rgba(0, 0, 0, 0.1);
}

    .add-button:hover {
        background-color: rgba(180, 180, 180, 0.5);
        border-color: rgba(120, 120, 120, 0.7);
        transform: translateY(-0.125rem);
        box-shadow: 0em 0.25em 0.5em rgba(0, 0, 0, 0.2);
    }

    .add-button:active {
        background-color: rgba(160, 160, 160, 0.6);
        border-color: rgba(100, 100, 100, 0.8);
        transform: translateY(0);
    }

.operation-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background-color: #f3f4f6;
    color: #4b5563;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 1.1em;
    font-weight: 700;
    border: 0.0625rem solid #e5e7eb;
    border-radius: 50%;
    margin: 0 0.5rem;
    box-shadow: inset 0 0.0625rem 0.1875rem rgba(0,0,0,0.05);
    z-index: 1;
    user-select: none;
    line-height: 0;
    padding-bottom: 0.125rem;
}

/* Special "OR" Divider Label */
.operation-label.or-divider {
    width: auto;
    height: 1.75rem;
    border-radius: 0.875rem;
    padding: 0 0.875rem;
    font-size: 0.8em;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #374151;
    letter-spacing: 0.03125rem;
    box-shadow: 0 0.0625rem 0.125rem rgba(0,0,0,0.1);
    text-shadow: 0 0.0625rem 0 rgba(255,255,255,0.5);
    text-transform: uppercase;
    padding-bottom: 0;
}

.new-chart {
    display: block;
    width: 100%;
    margin: 1em auto;
    padding: 0.75em;
    max-width: 40em;
}

.inside-chart {
    padding: 0.5em;
}

.chart-main-container {
    width: 100%;
    display: flex;
    flex-direction: row; /* Enforce side-by-side */
    flex-wrap: nowrap;
    box-sizing: border-box;
}

.chart-main {
    flex: 1 1 0; /* Tells the chart to take all available remaining space */
    min-width: 0; /* Prevents flexbox overflow bugs with Chart.js */
    position: relative; /* CRITICAL for Chart.js resizing */
    min-height: 50dvh;  /* Gives the chart a baseline height */
}

.chart-control-container, .chart-rate-control-container {
    display: flex;
    flex-direction: column;
    flex: 0 0 17.5rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5em;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    min-width: 16.25rem;
    width: 100%;
    box-sizing: border-box;
    border-left: 0.0625rem solid transparent;
}

.control-elements-container {
    display: flex;
    flex-direction: column;
    width: 100%; /* Inherits the stretched width */
    align-items: stretch;
    padding: 1rem;
    gap: 0.75rem;
    background-color: #f8fafc; /* Gives it a card-like appearance */
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.625rem;
    box-sizing: border-box;
    box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.02);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.control-elements-container:hover {
    border-color: #cbd5e1;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.05);
}

.control-label-container {
    display: flex;
    gap: 0.25em;
}

.control-label {
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    margin-bottom: 0.125rem;
}

.input-wrapper-col {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    box-sizing: border-box;
}

.control-textbox {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 0.125rem solid #333;
    border-radius: 0.25rem;
    font-size: inherit;
    font-weight: 600;
    outline: none;
    align-content: center;
    transition: all 0.2s ease-in-out;
    background-color: white;
    white-space: nowrap;
}

.Common-Textbox {
    width: 100%;
    height: 100%;
    min-width: 3.125rem;
    max-width: fit-content;
    font-size: inherit;
    padding: 0rem 0rem 0rem 0.25rem;
    border: 0.125rem solid #333;
    border-radius: 0.25rem;
    align-content: center;
    transition: all 0.2s ease-in-out;
    background-color: white;
}

    .Common-Textbox:focus, .control-textbox:focus {
        border-color: #555;
        background-color: #f9f9f9;
    }

    .Common-Textbox:hover, .control-textbox:hover {
        border-color: #222;
        background-color: #eee;
    }

.control-slider {
    width: 100%;
    appearance: none;
    height: 0.375rem;
    border-radius: 0.25rem;
    background: #ddd;
    outline: none;
    transition: background 0.2s ease;
}

    .control-slider:hover {
        background: #ccc;
    }

    .control-slider::-webkit-slider-thumb {
        appearance: none;
        width: 1rem;
        height: 1rem;
        border-radius: 50%;
        background: var(--thumb-color, #888);
        cursor: pointer;
        border: 0.125rem solid #333;
        transition: background 0.2s;
    }

.select {
    appearance: none;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    background-color: #fff;
    border: 0.125em solid #aaaaaa;
    border-radius: 0.375em;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: 0em 0.125em 0.375em rgba(0, 0, 0, 0.1);
}

    /* Hover effect */
    .select:hover {
        background-color: #f0faff;
    }

    /* Focus effect */
    .select:focus {
        border-color: #008ba3;
        box-shadow: 0em 0em 0.375em rgba(0, 188, 212, 0.5);
        outline: none;
    }

/* Custom dropdown arrow */
.chartType {
    appearance: none;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 1em;
    font-weight: 600;
    color: #334e68;
    background-color: #ffffff;
    border: 0.0625rem solid #cbd5e1;
    border-radius: 0.5rem; /* Matches the new toolbar rounded corners */
    cursor: pointer;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem; 
    height: 100%;
    transition: all 0.2s ease;
    box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
    white-space: nowrap;
    text-overflow: ellipsis;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2300bcd4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.5em center;
    background-size: 1em;
    
}

/* Style for dropdown options */
.chartType option {
    background: white;
    color: #333;
}

.select-group-color-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.25rem;
    border-radius: 0.75rem; /* Matches the inner elements nicely */
    background-color: #ffffff; /* Prevents the shadow from bleeding inside */
    transition: box-shadow 0.3s ease-in-out, border 0.3s ease-in-out;
}

.chartOperation {
    text-align: center;
    padding: 0 0.75em 0 0.75em;
    color: #989898;
    background-color: #fff;
    border: 0.125em solid rgba(150, 150, 150, 0.5);
    border-radius: 0.5em;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: 0em 0.125em 0.375em rgba(0, 0, 0, 0.1);
}

.chartOperation option {
    font-weight: bold;
    background: white;
    color: #333;
    /*padding: 0.6em;*/
}

.chartOperation option:hover {
    background: #00bcd4;
    color: white;
}

.chartOperation.chart-type-btn {
    height: 2.5rem; /* Exact match to the .select height */
    width: 2.5rem; /* Makes it a perfect square */
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem; /* Slightly larger for the emoji/icon */
    background-color: #ffffff;
    border: 0.0625rem solid #cbd5e1;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
    margin-left: 0.375rem !important; /* Forces a clean gap between dropdown and button */
}

.chartOperation.chart-type-btn:hover {
    background-color: #f0fdfa; /* Subtle cyan tint on hover */
    border-color: #00bcd4;
    transform: translateY(-0.0625rem);
}

.chartOperation.chart-type-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.add-btn-dropdown-container {
    position: relative;
    display: flex;
}

.add-btn-dropdown, .control-button {
    appearance: none;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    background-color: #fff;
    border: 0.125em solid #000000;
    border-radius: 0.375em;
    cursor: pointer;
    padding: 0.6em 1em;
    transition: all 0.3s ease-in-out;
    box-shadow: 0em 0.125em 0.375em rgba(0, 0, 0, 0.1);
}

    .add-btn-dropdown:hover, .control-button:hover {
        background-color: #f0faff;
    }

/* --- Tax Toggle Buttons & Inputs --- */
.tax-toggle-on {
    background-color: #e0f7fa !important;
    color: #00bcd4 !important;
    border-color: #00bcd4 !important;
    font-weight: bold;
}

.tax-toggle-off {
    background-color: #f1f5f9 !important;
    color: #94a3b8 !important;
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
}

.tax-input-off {
    background-color: #f8fafc !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
}

.tax-input-off::placeholder {
    color: #cbd5e1 !important;
}

/* --- MODERNIZED DROPDOWN STYLING --- */
.add-btn-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.3125rem);
    left: 0;
    background: #ffffff;
    border: 0.0625rem solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 0.625rem 1.5625rem rgba(0, 0, 0, 0.1);
    min-width: 11.25rem;
    overflow: hidden;
    z-index: 100;
}

.add-btn-dropdown-menu.show {
    display: block;
    animation: fadeInMenu 0.2s ease-out;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-0.3125rem); }
    to { opacity: 1; transform: translateY(0); }
}

.add-btn-dropdown-menu div {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    color: #374151; /* Dark Slate */
    border-bottom: 0.0625rem solid #f3f4f6;
    transition: background-color 0.2s, color 0.2s;
}

.add-btn-dropdown-menu div:last-child {
    border-bottom: none;
}

.add-btn-dropdown-menu div:hover {
    background-color: #f0fdfa; /* Subtle Cyan tint */
    color: #00bcd4; /* Match your app's cyan theme */
    font-weight: bold;
}

.Check-Margin-Container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.1875rem 0.75rem;
    background: #f8fafc; 
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.5rem;
    box-sizing: border-box;
    min-height: 2.375rem; 
    transition: all 0.2s ease;
}

.Check-Margin-Container:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}


.Check-Margin-Label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    gap: 0.5rem;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-weight: 600;
    color: #4b5563;
    user-select: none;
    white-space: nowrap;
}

/* Hide the real default checkbox */
.Check-Margin-Label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* The custom visual checkbox box */
.Check-Margin-Span {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    border: 0.125rem solid #cbd5e1;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background-color: #ffffff;
    box-shadow: inset 0 0.0625rem 0.125rem rgba(0,0,0,0.05);
}

/* Hover glow effect */
.Check-Margin-Label:hover .Check-Margin-Span {
    border-color: #00bcd4;
    box-shadow: 0 0 0 0.1875rem rgba(0, 188, 212, 0.15);
}

/* Checked State - Fills with Cyan */
.Check-Margin-Label input:checked ~ .Check-Margin-Span {
    background-color: #00bcd4;
    border-color: #00bcd4;
}

/* Drawn Checkmark Icon */
.Check-Margin-Label input:checked ~ .Check-Margin-Span::after {
    content: "";
    display: block;
    width: 0.25rem;
    height: 0.5rem;
    border: solid white;
    border-width: 0 0.125rem 0.125rem 0;
    transform: rotate(45deg);
    margin-top: -0.125rem;
}

/* Accessibility Focus */
.Check-Margin-Label input:focus-visible ~ .Check-Margin-Span {
    outline: 0.125rem solid #005f6b;
    outline-offset: 0.125rem;
}





.unit-select {
    text-align: center;
    text-align-last: center; /* Forces the active selected item to center */
    padding-left: 0; /* Removes default padding that offsets the text */
}





.hidden-sliders {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}



/* Style for remove button (top-right) */
.remove-btn {
    background-color: #d32f2f; /* Red */
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.15em;
    transition: all 0.3s ease-in-out;
    box-shadow: 0em 0.125em 0.375em rgba(0, 0, 0, 0.2);
}



    /* Hover effect */
    .remove-btn:hover {
        background-color: #b71c1c;
        transform: scale(1.025);
    }

    /* Active (click) effect */
    .remove-btn:active {
        background-color: #9a0007;
        transform: scale(1);
    }

.remove-chart {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevents the button from becoming an oval */
    font-size: 1.2em;
    width: 2.5em;
    height: 2.5em;
    border-radius: 50%;
    top: auto;
    right: auto;
}

/* Wrapper for centering */
.StartScreen-wrapper {
    display: flex;
    justify-content: center;
    
    height: 100vh;
    background: white;
}

/* Container for animations */
.StartScreen-container {
    position: relative;
    text-align: center;
    opacity: 0;
    animation: fadeIn 1.5s ease-out forwards;
}

/* Fix horizontal scroll issue caused by animations */
body {
    overflow-x: hidden;
}

/* --- New Startpage Title & Button Sizing --- */
.startpage-title {
    font-size: 4.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #00bcd4, #005f6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 5rem;
    margin-bottom: 5rem;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    letter-spacing: 0.25rem;
    text-shadow: 0.125rem 0.25rem 0.625rem rgba(0, 188, 212, 0.2);
}

.start-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
}

/* --- Search Loading Spinner --- */
.search-loading-spinner {
    width: 1.125rem;
    height: 1.125rem;
    border: 0.125rem solid rgba(0, 188, 212, 0.2);
    border-top-color: #00bcd4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.625rem;
}

/* Shared styles for both labels */
#StartScreen-Label, #StartWatch-Label, #StartSupport-Label {
    font-size: 2rem; /* Adjusted for better fit */
    font-family: "Arial", sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1875rem;
    padding: 1.5625rem 2.5rem;
    border-radius: 0.9375rem;
    cursor: pointer;
    position: relative;
    overflow: hidden; 
    color: #444;
    background: #EAECEF;
    box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.2);
    transform: translateY(0.1875rem); 
    transition: transform 0.2s ease-out; 
    
    /* Force identical sizes */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 28.125rem; 
    box-sizing: border-box;
}

#StartScreen-Label.start-animation {
    animation: rise-glow 1.5s ease-out forwards;
}

#StartWatch-Label.start-animation {
    animation: rise-glow-gray 1.5s ease-out forwards;
}

#StartSupport-Label.start-animation {
    animation: rise-glow-gray 1.5s ease-out forwards;
}

#StartScreen-Label.start-animation::before,
#StartWatch-Label.start-animation::before,
#StartSupport-Label.start-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%; 
    width: 100%;
    height: 100%;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 60%);
    animation: shimmer 2s ease-in-out forwards;
    animation-delay: 0.5s; 
}

#StartScreen-Label:hover, #StartWatch-Label:hover, #StartSupport-Label:hover {
    transform: scale(1.05) translateY(0);
}

@keyframes rise-glow {
    from {
        transform: translateY(0.1875rem);
        box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.2);
        background: #EAECEF;
        color: #444;
    }
    to {
        transform: translateY(0);
        background: linear-gradient(135deg, #ffffff, #F0F2F5);
        color: #2a7d2a; 
        text-shadow: 0 0 0.625rem rgba(255, 255, 255, 0.8);
        box-shadow: 0 0.5rem 1.875rem -0.3125rem rgba(40, 167, 69, 0.6), 0 0.25rem 0.375rem -0.125rem rgba(0, 0, 0, 0.1);
    }
}

@keyframes rise-glow-gray {
    from {
        transform: translateY(0.1875rem);
        box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.2);
        background: #EAECEF;
        color: #444;
    }
    to {
        transform: translateY(0);
        background: linear-gradient(135deg, #ffffff, #F0F2F5);
        color: #979797;
        text-shadow: 0 0 0.625rem rgba(255, 255, 255, 0.8);
        box-shadow: 0 0.5rem 1.875rem -0.3125rem rgba(97, 97, 97, 0.6), 0 0.25rem 0.375rem -0.125rem rgba(0, 0, 0, 0.1);
    }
}

@keyframes shimmer {
    to {
        left: 150%; 
    }
}



/* --- Keyframe Animations --- */

/* Animates the "rise" and "glow" effect */
@keyframes rise-glow {
    from {
        /* Matches the initial state */
        transform: translateY(0.1875rem);
        box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.2);
        background: #EAECEF;
        color: #444;
    }

    to {
        /* The final, "energized" state */
        transform: translateY(0);
        background: linear-gradient(135deg, #ffffff, #F0F2F5); /* Brighter, cleaner white */
        color: #2a7d2a; /* Positive green text color */
        text-shadow: 0 0 0.625rem rgba(255, 255, 255, 0.8);
        /* Green glow symbolizing growth, plus a subtle drop shadow */
        box-shadow: 0 0.5rem 1.875rem -0.3125rem rgba(40, 167, 69, 0.6), 0 0.25rem 0.375rem -0.125rem rgba(0, 0, 0, 0.1);
    }
}

/* Animates the shimmer effect */
@keyframes shimmer {
    to {
        left: 150%; /* Moves across the element to the other side */
    }
}

    /* Fade-in animation */
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-1.25rem);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    /* Sidebar Styling */
    .sidebar {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    background-color: #333;
    overflow-x: hidden;
    transition: 0.3s;
    padding-top: 7em;
    display: flex;
    flex-direction: column;
}

    .sidebar a {
        padding: 0.9375rem 1.5625rem;
        text-decoration: none;
        font-size: 1.125rem;
        color: white;
        transition: 0.2s;
    }

        .sidebar a:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }

.hamburger {
    font-size: 1.75rem;
    cursor: pointer;
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 1001;
    color: white;
}

/* Optional: Push content over when sidebar opens */
body.sidebar-open main,
body.sidebar-open header {
    margin-left: 15.625rem;
    transition: margin-left 0.3s;
}


.tabs-container {
    display: flex;
    align-items: center;
    border-bottom: 0.125rem solid #e0e0e0;
    margin-bottom: 0.625rem;
    background: linear-gradient(to right, #fefefe, #f5f5f5);
    border-radius: 0.75rem 0.75rem 0 0;
    box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.tab {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    background: #ffffff;
    border-radius: 0.625rem 0.625rem 0 0;
    border: 0.0625rem solid #dcdcdc;
    border-bottom: none;
    font-family: 'Arial', sans-serif;
    color: #333;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
    transition: all 0.25s ease-in-out;
    white-space: nowrap; /* Prevents text like "Real-estate" from breaking to a new line */
    flex-shrink: 0;
}

    .tab.active {
        background: linear-gradient(to top, #ffffff, #f9f9f9);
        font-weight: bold;
        color: #00bcd4;
        box-shadow: 0 0.25rem 0.75rem rgba(0, 188, 212, 0.1);
    }

    .tab:hover {
        background: #f1f1f1;
        color: #007a91;
    }

    .tab .close-btn {
        margin-left: 0.5rem;
        font-weight: bold;
        color: #d9534f;
        cursor: pointer;
        transition: color 0.2s ease;
    }

        .tab .close-btn:hover {
            color: #b52b27;
        }

.add-tab-btn {
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
    border: 0.0625rem solid #ccc;
    border-radius: 0.625rem 0.625rem 0 0;
    font-weight: bold;
    color: #007a91;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

    .add-tab-btn:hover {
        background: linear-gradient(135deg, #b2ebf2, #80deea);
        color: #005f6b;
    }

#myLabel2 {
    color: red;
}
#myLabel3 {
    color: blue;
}

/* --- Metric Info Button --- */
.metric-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background-color: #e2e8f0;
    color: #64748b;
    border: none;
    font-size: 0.75rem;
    font-weight: bold;
    font-family: serif;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    flex-shrink: 0;
}
.metric-info-btn:hover {
    background-color: #00bcd4;
    color: #fff;
    transform: scale(1.1);
}

/* --- Math Logic Modal --- */
.math-logic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: #334155;
    font-size: 0.9rem;
    text-align: left;
}
.math-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
}
.math-block h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #0f172a;
    font-size: 1rem;
    border-bottom: 2px solid #00bcd4;
    padding-bottom: 0.25rem;
    display: inline-block;
}
.math-row {
    display: flex;
    justify-content: flex-start;
    padding: 0.15rem 0;
}
.math-row .operator {
    width: 1.5rem;
    font-weight: bold;
    color: #64748b;
}
.math-result {
    font-weight: bold;
    border-top: 1px solid #cbd5e1;
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    color: #0f172a;
}

.chart-rate-buttons-container {
    display: flex;
    width: 100%;
    gap: 0.1875rem;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1.25rem;
    position: relative; /* Required for absolute centering of title */
}

/* Centers the title perfectly without pushing the buttons around */
.chart-rate-buttons-container .chart-Info-Title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    white-space: nowrap;
}

.chart-Info-Button {
    /* Basic Styling */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5em;
    height: 2.5em;
    border-radius: 50%;
    background-color: #f0f4f8;
    border: 0.0625rem solid #d9e2ec;
    color: #334e68;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
    /* Prevents text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

    /* Hover and Focus States for Interactivity */
    .chart-Info-Button:hover,
    .chart-Info-Button:focus {
        background-color: #e6eaf0;
        border-color: #c0cdd9;
        box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
        outline: none; /* Removes default focus outline */
    }

    /* Active State for Click Feedback */
    .chart-Info-Button:active {
        background-color: #d9e2ec;
        transform: translateY(0.0625rem);
        box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1);
    }

.Add-Remove-Button-Container {
    display: flex;
    width: 100%;
}

.Add-Remove-Button-Container > * {
    flex: 1;
}

.chart-header .Add-Remove-Button-Container {
    max-width: fit-content;
}

.chart-Info-Container {
    display: flex;
}

.Chart-header-buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    margin-right: 0.5rem;
    gap: 0.1875rem;
}

.your-outer-wrapper {
  display: flex;
  align-items: center; /* Keeps everything vertically aligned */
  width: 100%;
}

.chart-rate-container {
    position: fixed; /* Stays in place on scroll */
    z-index: 1000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95dvw;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    background-color: white;
    padding: 1.25rem;
    border: 0.0625rem solid #ccc;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
    box-sizing: border-box; /* Ensures padding is included in width/height */
    min-width: 0;
}

.canvas-and-control-container{
    display: flex;
    min-height: 50dvh;
    max-height: 90dvh;
    overflow-y: auto;
}

.canvas-rate-container {
    flex: 1 1 0; /* Tells the chart to take all available remaining space */
    position: relative; /* Important for the canvas element */
    min-height: 30dvh; /* Prevents flexbox overflow issues */
    min-width: 0; /* ADD THIS: Allows the container to shrink horizontally */
    max-height: 50dvh;
}

.chart-canvas {
    width: 100%;
    height: 100%;
}

.chart-Info-Title {
    text-align: center;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 2em;
    font-weight: 800;
    color: #1f2937;
}

.hidden {
    display: none !important; /* !important helps override other display styles */
}

/* --- NEW: DCF Page Title Styling --- */
.dcf-hero-header {
    text-align: center;
    margin-bottom: 1.875rem;
}

.dcf-page-title {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 3rem;
    color: #111827;
    margin-bottom: 0.9375rem;
    font-weight: 800;
    letter-spacing: -0.03125rem;
    text-shadow: 0.0625rem 0.125rem 0.25rem rgba(0,0,0,0.05);
}

.dcf-page-subtitle {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 1.2rem;
    color: #6b7280;
    font-weight: 400;
    max-width: 37.5rem;
    margin: 0 auto;
    line-height: 1.6;
}

.watchlist-title {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 2.5rem;
    color: #111827;
    margin-bottom: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.03125rem;
    text-align: center;
    border-bottom: 0.25rem solid #00bcd4;
    display: inline-block;
    padding-bottom: 0.625rem;
    text-shadow: 0.0625rem 0.125rem 0.25rem rgba(0,0,0,0.05);
}

/* --- Video Grid Base Layout --- */
.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns side-by-side */
    gap: 1.25rem; /* 20px gap */
    width: 80%;
    max-width: 50rem; /* 800px */
    margin: 0 auto; /* Centers the grid */
}

/* --- Custom Video Controls (Full Width) --- */
.custom-video-controls {
    width: 100%;
    gap: 10px;
    margin-top: 10px;
    /* display: flex; is handled by your JavaScript when the video is ready */
}

.custom-video-controls button {
    flex: 1; /* Makes both buttons take up exactly 50% of the space */
    justify-content: center; /* Ensures the text is perfectly centered */
}

/* --- Custom YouTube Facade --- */
.yt-facade {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.facade-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: filter 0.3s ease;
}

.yt-facade:hover .facade-thumbnail {
    filter: brightness(0.85); /* Slight dim on hover to make button pop */
}

.facade-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 68px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

/* Make sure we keep the translate coords so it doesn't snap back to top-left on click */
.yt-facade:active .facade-play-btn {
    transform: translate(-50%, -50%) scale(0.9);
}

/* Make the play button match your Cyan app theme on hover */
.yt-facade:hover .facade-play-btn .play-bg {
    fill: #00bcd4;
    fill-opacity: 1;
    transition: fill 0.2s ease, fill-opacity 0.2s ease;
}

/* Override for tutorial screen search box (Large Mode) */
#tutorial-screen .search-box {
    display: flex !important;      
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;                  
    max-width: 37.5rem; /* Restricts the center search bar so it isn't infinitely wide */
    margin: 0 auto;                
    position: relative; 
    z-index: 100;                  
}

/* Ensure the inner container stretches to fill the new width */
#tutorial-screen .search_input-container {
    width: 100%;
    border-color: #000;
}

#tutorial-screen .search_input-container input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;            
    font-size: 1.125rem;
}

/* Container card for video + title */
.video-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #ffffff;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.video-card:hover {
    transform: translateY(-0.125rem);
}

/* Video aspect ratio maintainer */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    background: #000000;
    border-radius: 0.5rem;
    overflow: hidden;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Placeholder card styling styling */
.video-wrapper.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #475569;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-weight: 600;
}

/* Matching Title Typography */
.video-title {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a; /* Deep premium slate matching your app headers */
    margin: 0;
    padding: 0.25rem 0.125rem;
    line-height: 1.4;
    letter-spacing: -0.01rem;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 2.2rem; /* Makes it nice and large */
    color: #888;
    cursor: pointer; /* Gives it the clickable hand cursor */
    line-height: 1;
    transition: color 0.2s ease;
    user-select: none; /* Prevents accidental highlighting */
    z-index: 10;
}

.close-modal:hover {
    color: #333;
}

/* --- Settings Modal Sidebar Styles --- */
.sidebar-menu-btn {
    width: 100%;
    text-align: left;
    padding: 0.9375rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 0.0625rem solid #eee;
    font-family: 'Arial', sans-serif;
    font-size: 0.875rem;
    color: #555;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, font-weight 0.2s;
}

.sidebar-menu-btn:hover {
    background-color: #f0fdfa;
    color: #00bcd4;
}

.sidebar-menu-btn.active {
    background-color: #e0f7fa;
    color: #007a91;
    font-weight: bold;
    border-left: 0.25rem solid #00bcd4;
    padding-left: 1rem; /* Adjust padding to offset the border width */
}

/* --- Modal Overlay & Content --- */
.modal-overlay {
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0, 0, 0, 0.6); 
    z-index: 3000; 
    align-items: center; 
    justify-content: center;
    backdrop-filter: blur(0.1875rem);
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white; 
    padding: 1.875rem; 
    border-radius: 0.75rem; 
    width: 100%; 
    max-width: 23.75rem; 
    position: relative;
    box-shadow: 0 0.625rem 1.875rem rgba(0,0,0,0.2);
    font-family: 'Arial', sans-serif;
}

/* --- Auth Forms --- */
.auth-title {
    color: #333; 
    margin-bottom: 1.25rem; 
    text-align: center;
}

.auth-view {
    display: flex; 
    flex-direction: column; 
    gap: 0.9375rem;
}

.auth-submit {
    width: 100%; 
    margin-left: 0; 
    margin-top: 0.625rem;
}

.auth-links {
    display: flex; 
    justify-content: space-between; 
    margin-top: 0.625rem; 
    font-size: 0.8125rem;
}

.auth-links a {
    color: #00bcd4; 
    text-decoration: none; 
    transition: color 0.2s;
}

.auth-links a:hover { color: #007a91; }

/* --- My Account Dropdown --- */
.my-account-wrapper {
    position: relative;
    display: inline-block;
}

.my-account-btn {
    padding: 0.625rem 1.25rem;
}

.account-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 11.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
    border-radius: 0.5rem;
    border: 0.0625rem solid #eee;
    z-index: 2500;
    flex-direction: column;
    overflow: hidden;
}

/* Triggers via JavaScript instead of hover for mobile support */
.account-dropdown.show {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.account-dropdown a {
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #333;
    font-family: 'Arial', sans-serif;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.account-dropdown a:hover {
    background: #f5f5f5;
    color: #00bcd4;
}

/* --- Watchlist Styles --- */
#watchlist-screen {
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

#watchlist-table-container {
    width: 100%;
    margin: 0 auto;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.9375rem rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    box-sizing: border-box;
}

/* Forces table to scroll horizontally on small screens instead of breaking */
.wl-table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 0.0625rem solid #e2e8f0;
    margin-bottom: 1.25rem;
}

.watchlist-table {
    width: 100%;
    min-width: 53.125rem; /* ~850px minimum width before scrolling triggers */
    border-collapse: collapse;
    background: #fff;
}

.watchlist-table th, .watchlist-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 0.0625rem solid #e2e8f0;
    vertical-align: middle;
    white-space: nowrap; 
    font-size: max(0.9rem, 14px); /* Standardize base text size */
}

.watchlist-table th {
    background-color: #f8fafc;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.watchlist-table tr:last-child td {
    border-bottom: none;
}

.watchlist-table tr:hover td {
    background-color: #f8fafc;
}

/* Seamless Input Styling */
.wl-input {
    width: 100%;
    min-width: 7rem;
    padding: 0.5rem; /* Added for better touch targets */
    border: 0.0625rem solid transparent; 
    border-radius: 0.375rem;
    box-sizing: border-box;
    font-family: inherit;
    font-size: max(1rem, 16px); /* Crucial: Prevents mobile zoom and keeps text legible */
    color: #334155;
    background-color: transparent;
    transition: all 0.2s ease;
}

.wl-input:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.wl-input:focus {
    background-color: #ffffff;
    border-color: #00bcd4;
    outline: none;
    box-shadow: 0 0 0 0.1875rem rgba(0, 188, 212, 0.15);
}

/* Performance & Diff Colors */
.text-green { color: #10b981; font-weight: 600; }
.text-red { color: #ef4444; font-weight: 600; }

/* Button Grouping & Styling */
.wl-controls-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.wl-add-btn, .wl-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wl-add-btn {
    background: #0f172a; /* Premium Slate */
    color: #ffffff;
    border: 0.0625rem solid #0f172a;
    box-shadow: 0 0.125rem 0.25rem rgba(15, 23, 42, 0.2);
}

.wl-add-btn:hover {
    background: #1e293b;
    transform: translateY(-0.0625rem);
}

.wl-refresh-btn {
    background: #ffffff;
    color: #334155;
    border: 0.0625rem solid #cbd5e1;
    box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.05);
}

.wl-refresh-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.wl-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #fef2f2;
    color: #ef4444;
    border: 0.0625rem solid #fca5a5;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wl-remove-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: scale(1.05);
}

.save-watchlist-btn {
    padding: 0.5rem 1rem;
    color: #0f172a;
    background: #f8fafc;
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.05);
}

.save-watchlist-btn:hover { 
    background: #f0fdfa; 
    color: #00bcd4;
    border-color: #00bcd4;
}


/* --- UI Feedback Animations (Loading & Success) --- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 0.125rem solid rgba(0, 0, 0, 0.2);
    border-top-color: #00bcd4; /* Cyan to match your theme */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

.success-checkmark {
    color: #28a745;
    font-weight: bold;
    font-size: 1.1em;
}

.error-cross {
    color: #dc3545;
    font-weight: bold;
}

/* --- Stock Chart Settings Menu --- */
.chart-settings-container {
    position: relative;
    display: flex;
    align-items: center;
}

.settings-btn {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: #555;
    transition: transform 0.2s ease, color 0.2s ease;
}

.settings-btn:hover {
    transform: scale(1.1);
    color: #00bcd4; /* Cyan to match your theme */
}

.settings-menu {
    display: none;
    position: absolute;
    right: 100%; /* Reveals exactly to the left of the button */
    top: -0.3125rem;
    margin-right: 0.625rem; /* Slight gap between button and menu */
    background: #ffffff;
    border: 0.0625rem solid #e5e7eb;
    box-shadow: -0.25rem 0.25rem 0.9375rem rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.9375rem 1.25rem;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 100;
    white-space: nowrap;
}

.settings-menu.show {
    display: flex;
    animation: fadeInMenu 0.2s ease-out;
}

.settings-menu label {
    font-family: 'Arial', sans-serif;
    font-weight: bold;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =========================================================================
   DYNAMIC UI CLASSES (Refactored from JS inline styles)
   ========================================================================= */

/* --- General Layout Helpers --- */
.value-header-flex { display: flex; align-items: center; justify-content: center; gap: 0.625rem; }
.no-margin-y { margin-top: 0; margin-bottom: 0; }
.growth-val-input { width: 3.75rem; margin-left: 0.3125rem; margin-right: 0.3125rem; }
.bs-edit-btn { position: absolute; right: 0; width: 1.875rem; height: 1.875rem; font-size: 0.875rem; }
.bs-title-flex { position: relative; display: flex; justify-content: center; align-items: center; }
.flex-wrap-gap { display: flex; flex-wrap: wrap; gap: 0.9375rem; }

/* --- Modals (Global, Financials, Settings, Confirm) --- */
.modal-content-standard {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.modal-content-medium { max-width: 25rem; } /* ~400px */
.modal-content-large { max-width: 37.5rem; width: 90vw; min-height: 30rem; } /* ~600px / 480px */
.modal-content-financial { max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; padding: 1.25rem; }

.modal-header-styled {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9375rem;
    border-bottom: 0.0625rem solid #eee;
    padding-bottom: 0.625rem;
}
.modal-header-premium {
    padding: 0.9375rem 1.25rem;
    background-color: #f8f9fa;
    margin-bottom: 0;
}
.modal-title-styled {
    margin: 0;
    color: #333;
    font-family: Arial, sans-serif;
    font-size: 1.125rem; /* 18px */
}
.modal-close-styled {
    background: none;
    border: none;
    font-size: 1.75rem; /* 28px */
    cursor: pointer;
    color: #888;
    padding: 0;
    line-height: 1;
}
.modal-close-styled.btn-square { width: 2rem; height: 2rem; position: static; }

/* --- Modal Layouts --- */
.modal-body-container { display: flex; flex: 1; }
.modal-sidebar {
    width: 35%;
    border-right: 0.0625rem solid #eee;
    background-color: #fdfdfd;
    display: flex;
    flex-direction: column;
}
.modal-content-area { width: 65%; padding: 1.5625rem; overflow-y: auto; }

/* --- Settings Inputs & Text --- */
.settings-desc-text { font-size: 0.8125rem; color: #666; margin-left: 2.1875rem; margin-top: 0.25rem; }
.settings-desc-text-up { margin-top: -0.625rem; }
.settings-input-group { margin-left: 2.1875rem; margin-top: 0.625rem; }
.settings-input-label { font-size: 0.875rem; font-weight: bold; color: #444; display: flex; align-items: center; }
.settings-tiny-input { width: 4.375rem; margin-left: 0.3125rem; }
.settings-small-input { width: 5rem; margin-left: 0.3125rem; }

/* --- Financial Data Tables --- */
.financial-table-container {
    flex: 1;
    overflow: auto;
    border: 0.0625rem solid #ccc;
    border-radius: 0.5rem;
    background: #fff;
}
.financial-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: Arial, sans-serif;
    font-size: 0.875rem;
}
.sticky-corner {
    position: sticky; top: 0; left: 0;
    background-color: #f8f9fa; color: #333;
    padding: 0.75rem 0.9375rem;
    border-bottom: 0.125rem solid #ccc; border-right: 0.125rem solid #ccc;
    text-align: left; font-weight: bold; z-index: 3;
}
.sticky-header {
    position: sticky; top: 0;
    background-color: #f8f9fa; color: #333;
    padding: 0.75rem 0.9375rem;
    border-bottom: 0.125rem solid #ccc;
    text-align: right; font-weight: bold; z-index: 2;
}
.sticky-header-ytd { background-color: #e0f7fa; color: #007a91; }
.sticky-col {
    position: sticky; left: 0;
    background-color: #fff; color: #444;
    padding: 0.625rem 0.9375rem;
    border-right: 0.125rem solid #ccc; border-bottom: 0.0625rem solid #eee;
    font-weight: bold; z-index: 1;
}
.table-section-row {
    background-color: #e0f7fa; color: #007a91;
    font-weight: bold; padding: 0.75rem 0.9375rem;
    position: sticky; left: 0; z-index: 1;
}
.table-data-cell { padding: 0.625rem 0.9375rem; border-bottom: 0.0625rem solid #eee; text-align: right; color: #555; }
.table-ytd-cell {
    padding: 0.625rem 0.9375rem; border-bottom: 0.0625rem solid #eee;
    text-align: right; color: #007a91; font-weight: bold; background-color: #fdfdfd;
}

/* Replaces JS onmouseover / onmouseout */
.financial-table tbody tr:hover td { background-color: #f1f1f1 !important; }

/* --- Preset Buttons --- */
.preset-btn {
    padding: 0.9375rem;
    margin-bottom: 0.625rem;
    background-color: #f8fafc;
    border: 0.0625rem solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: bold;
    color: #334155;
    transition: all 0.2s ease;
}
.preset-btn:hover { border-color: #00bcd4; background-color: #f0fdfa; }

/* --- Confirm Modal Specifics --- */
.confirm-msg { margin-bottom: 1.5625rem; color: #555; font-size: 1rem; }
.confirm-btn-container { display: flex; justify-content: center; gap: 0.9375rem; }
.confirm-proceed-btn { margin: 0; padding: 0.625rem 1.25rem; font-size: 0.9375rem; }
.strike-through-text { text-decoration: line-through; color: #999; margin-right: 0.5rem; }
.highlight-text-red { color: #d9534f; font-weight: bold; }
.confirm-proceed-btn.wl-remove-btn {
    width: auto;
    height: auto;
    border-radius: 0.5rem;
}















/* =========================================================================
   NARROW FIXES (e.g. Phones)
   ========================================================================= */
@media screen and (max-width: 55rem) {
    html {
        font-size: 70%;
    }

    header {
        height: 8rem;
    }

    .hamburger {
        font-size: 3rem;
        top: 2rem;
    }

    .login-btn {
        font-size: 1.2rem;
        margin: 0;
    }

    .startpage-title {
        font-size: 2.5rem;
    }

    .video-grid {
        grid-template-columns: 1fr;
        width: 100%; /* Let it take up the full screen width on phones */
    }

    #search-placeholder {
        padding: 0 1.5rem; /* Adds breathing room on the left and right */
        box-sizing: border-box;
    }

    #searchCompanie {
        margin-right: 0;
    }

    .chart-Info-Label-Name {
        font-size: 1.4em;
    }

    .chart-main-container {
        flex-direction: column;
    }
    
    .chart-main {
        width: 100%;
    }

    /* 1. Stack the chart and controls vertically */
    .chart-main-container, 
    .canvas-and-control-container {
        flex-direction: column;
    }

    /* 2. Position the control container below the chart */
    .chart-control-container, .chart-rate-control-container {
        width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
        border-left: none;
        border-top: 0.0625rem solid #e2e8f0; /* Visual separator */
        margin-top: 1rem;
    }

    .control-elements-container {
        width: 100%;
        align-items: stretch;
        box-sizing: border-box;
        gap: 1.5625rem;
        font-size: 1.375rem;
    }

    .trackbar {
        height: 0.625rem;
    }

    .trackbar::-webkit-slider-thumb {
        width: 1.375rem;
        height: 1.375rem;
    }

    .control-slider {
        height: 0.625rem; /* Thicker track */
    }

    .control-slider::-webkit-slider-thumb {
        width: 1.375rem;
        height: 1.375rem;
    }

    .Check-Margin-Label {
        font-size: 1.375rem;
        padding: 0.5rem 0;
    }

    .Check-Margin-Span {
        width: 1.375rem;
        height: 1.375rem;
    }

    #watchlist-screen {
        padding: 0 0.5rem;
    }

    #watchlist-table-container {
        padding: 0.75rem; /* Recover screen space on narrow devices */
    }

    .watchlist-title {
        font-size: 2rem; /* Scale title down slightly */
        margin-bottom: 1rem;
    }

    .watchlist-table th, .watchlist-table td {
        padding: 0.5rem; /* Compress cells so more fit on screen */
        font-size: 15px; /* Equalized font size for mobile */
    }

    .wl-input {
        min-width: 6rem; /* Allow slight compression to reduce scrolling */
        font-size: 16px; /* Lock text box size */
        padding: 0.6rem 0.4rem; 
    }

    /* Stack the buttons for easier thumb tapping */
    .wl-controls-group {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        margin-top: 1rem;
    }

    .wl-add-btn, .wl-refresh-btn {
        width: 100%;
        padding: 0.875rem;
        font-size: 16px;
    }
}

@media screen and (max-aspect-ratio: 4/3) {

    /* On smaller screens, scale EVERYTHING down by changing the root size */
    @media screen and (max-width: 48rem) {
        html {
            font-size: 75%;
        }
        .logo-text {
            display: none;
        }
         .chart-Info-Left-Header {
            flex-direction: column;
        }
        .chart-metrics-toolbar {
            flex-direction: column;
        }
        .operation-only-select-container {
            font-size: 4vw;
        }
        
    }

    main, footer {
        margin: 0;
        font-size: 1.375rem;
    }

    /* 1. Stack the Top Info Section (Right falls below Left) */
    .chart-Info-All {
        flex-direction: column;
    }
    
    .chart-Info-Left, 
    .chart-Info-Right {
        width: 100%;
    }

    /* Add breathing room between the stacked info sections */
    .chart-Info-Left {
        margin-bottom: 1.25rem;
    }

    /* 2. Stack the Main Chart and its Controls (Controls fall below Chart) */
    .chart-main-container {
        flex-direction: column;
    }
    
    .chart-main {
        width: 100%;
    }

    /* 3. Stack Balance Sheet columns so Assets and Liabilities don't squash */
    .chart-Info-Balance-Sheet {
        flex-direction: column;
    }
    
    .chart-Info-Assets, 
    .chart-Info-Liab {
        width: 100%;
        margin-bottom: 0.625rem;
    }

    /* 1. Stack the chart and controls vertically */
    .chart-main-container, 
    .canvas-and-control-container {
        flex-direction: column;
    }

    /* 2. Position the control container below the chart */
    .chart-control-container, .chart-rate-control-container {
        width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
        border-left: none;
        border-top: 0.0625rem solid #e2e8f0; /* Visual separator */
        margin-top: 1rem;
    }

    .control-elements-container {
        width: 100%;
        align-items: stretch;
        box-sizing: border-box;
        gap: 1.5625rem;
        font-size: 1.375rem;
    }

    .trackbar {
        height: 0.625rem;
    }

    .trackbar::-webkit-slider-thumb {
        width: 1.375rem;
        height: 1.375rem;
    }

    .control-slider {
        height: 0.625rem; /* Thicker track */
    }

    .control-slider::-webkit-slider-thumb {
        width: 1.375rem;
        height: 1.375rem;
    }

    .Check-Margin-Label {
        font-size: 1.375rem;
        padding: 0.5rem 0;
    }

    .Check-Margin-Span {
        width: 1.375rem;
        height: 1.375rem;
    }

    
    
}