body {
    font-family: Verdana, Arial, sans-serif;
    background-color: #f0f0f0;
    color: #333;
    margin: 0;
    padding: 10px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

h1 {
    text-align: center;
    color: #000;
    border-bottom: 2px solid #999;
    padding-bottom: 8px;
    margin: 0 0 10px 0;
    flex-shrink: 0;
}

h2 {
    color: #111;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.05em;
}

.main-content {
    display: flex;
    flex-direction: column; /* Stack top-row and controls-row vertically */
    flex-grow: 1;
    gap: 10px;
    overflow: hidden;
    width: 90%;         /* Keep centered layout */
    max-width: 1400px;   /* Keep centered layout */
    margin-left: auto;  /* Keep centered layout */
    margin-right: auto; /* Keep centered layout */
}

/* Styles for the top row containing chart and tips */
.top-row {
    display: flex;
    flex-direction: row; /* Chart and Tips side-by-side */
    flex-grow: 1;        /* Take up available vertical space */
    gap: 10px;
    min-height: 150px;   /* Ensure it has some minimum height */
    overflow: hidden;    /* Prevent content spillover */
}

/* Chart Container Styles */
.chart-container {
    flex-basis: 65%;    /* Suggest width proportion */
    flex-grow: 1;       /* Allow growing if needed */
    flex-shrink: 1;     /* Allow shrinking */
    min-width: 400px;
    min-height: 150px;
    padding: 5px;
    border: 1px solid #999;
    background-color: #fff;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    display: flex;
    position: relative;
}

#pidChart {
    max-width: 100%;
    max-height: 100%;
    /* border: 2px dashed red; */ /* Remove or keep debug border */
}

/* Styles for the Tips Section */
.tips-section {
    flex-basis: 35%;    /* Suggest width proportion */
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 250px;
    /* Inherits background, border, padding etc from .control-section */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tips-section h2 {
    flex-shrink: 0;
    color: #003366;
    border-bottom: 1px solid #a0b0c0;
}

/* NEW: Styles for the Tips Section */
.tips-section {
    flex-basis: 35%;    /* Suggest width proportion */
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* **** Ensure parent hides overflow too **** */
}

.tips-section h2 {
    flex-shrink: 0;
    color: #003366;
    border-bottom: 1px solid #a0b0c0;
}

/* Container for the link button within tips */
.tips-section .navigation-link {
    margin-top: auto;       /* Pushes the link to the bottom of the flex container */
    padding-top: 10px;      /* Space above the button */
    text-align: center;     /* Center the button horizontally */
    flex-shrink: 0;         /* Prevent this container from shrinking */
    margin-bottom: 5px;     /* Add a little space at the very bottom */
}

/* Styling the link itself like a button */
.tips-section .navigation-link a {
    display: inline-block;  /* Allows padding and acts like a block */
    padding: 8px 16px;      /* Button padding (vertical, horizontal) */
    background-color: #007bff; /* A distinct blue color */
    color: white;           /* White text */
    border: 1px solid #0056b3; /* Slightly darker border */
    border-radius: 5px;     /* Rounded corners */
    text-decoration: none;  /* Remove underline */
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease; /* Smooth transitions */
}

/* Hover effect */
.tips-section .navigation-link a:hover {
    background-color: #0056b3; /* Darker blue on hover */
    color: white;           /* Keep text white */
}

/* Active (click) effect */
.tips-section .navigation-link a:active {
    background-color: #004085; /* Even darker blue */
    transform: translateY(1px); /* Slight press down effect */
}
.tips-content {
    flex-grow: 1;
    /* overflow-y: auto;      <---- REMOVE THIS LINE */
    overflow-y: hidden;     /* <---- ADD THIS LINE (Prevent scrollbar explicitly) */
    font-size: 0.85em;      /* <---- REDUCE Font size slightly more */
    line-height: 1.3;       /* <---- REDUCE Line height */
    padding-right: 5px;
    padding-bottom: 5px;    /* Optional: Add a little bottom padding */
}

.tips-content p {
    margin-top: 0;          /* Remove potential top margin on first paragraph */
    margin-bottom: 4px;    /* Reduce margin below paragraphs */
}


.tips-content ul, .tips-content ol {
    margin-top: 3px;        /* <---- REDUCE Top margin */
    padding-left: 16px;     /* <---- REDUCE Indentation */
}

.tips-content li {
    margin-bottom: 4px;     /* <---- REDUCE Space between tips */
}


/* Controls row styles */
.controls-row {
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    min-height: 215px; /* Compressed height - adjust if needed */
    gap: 10px;
    overflow: hidden;
}

/* Shared style for sections */
.control-section {
    flex: 1;
    background-color: #e8e8e8;
    border: 1px solid #aaa;
    padding: 6px 8px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    min-width: 210px;
}

/* Explicit overflow for specific sections */
#info-box {
    overflow-y: hidden;
    background-color: #e0e8f0;
    border: 1px solid #a0b0c0;
}
#pid-section {
    overflow-y: hidden; /* PID controls fit */
}
#manual-section {
    overflow-y: hidden; /* Manual controls fit */
}
.info-box #info-text { /* Scroll inside info-box's text p */
    overflow-y: auto;
}

/* Info-box specific styles */
.info-box h2 {
    color: #003366;
    border-bottom: 1px solid #a0b0c0;
    flex-shrink: 0;
}
#info-text {
    font-size: 0.9em;
    line-height: 1.3;
    color: #222;
    word-wrap: break-word;
    flex-grow: 1;
    margin-top: 4px;
}

/* Notes styles */
.notes {
    font-size: 0.75em;
    margin-bottom: 4px;
    background-color: #fdfdfd;
    border: 1px dashed #ccc;
    padding: 3px 5px;
    flex-shrink: 0;
}
.notes ul {
    margin: 2px 0 0 0;
    padding-left: 12px;
}

/* Control group styles */
.control-group {
    margin-bottom: 4px;
    flex-shrink: 0;
}
.control-group.slider-group {
    margin-bottom: 3px;
}
.control-group label {
    display: block;
    margin-bottom: 1px;
    font-weight: bold;
    font-size: 0.9em;
}

/* Manual section specifics */
#manual-section .control-group label {
    display: inline-block;
    margin-right: 5px;
    font-size: 0.95em;
}
#manual-section input[type="number"] {
    width: 60px;
    padding: 3px 5px;
}

/* Slider group styles */
.slider-group input[type="range"] {
    width: calc(100% - 10px);
    margin: 1px 5px 0 5px;
    cursor: pointer;
    vertical-align: middle;
    height: 16px;
    box-sizing: border-box;
}

/* Input/Button styles */
input[type="number"],
input[type="text"] {
    padding: 3px 5px;
    border: 1px solid #999;
    background-color: #fff;
    font-size: 0.9em;
}
button {
    padding: 4px 8px;
    border: 1px solid #777;
    background-color: #d0d0d0;
    color: #000;
    cursor: pointer;
    font-size: 0.9em;
    border-radius: 3px;
    box-shadow: 1px 1px 1px rgba(0,0,0,0.2);
    margin-right: 5px;
    vertical-align: middle;
}
button:hover { background-color: #c0c0c0; }
button:active { background-color: #b0b0b0; box-shadow: inset 1px 1px 1px rgba(0,0,0,0.2); }
button:disabled { background-color: #e0e0e0; color: #888; cursor: not-allowed; box-shadow: none; }


/* Main buttons styles */
.main-buttons {
    margin-bottom: 6px;
}

/* PID Status styles */
#pidStatus { display: inline-block; margin-left: 8px; font-weight: bold; padding: 3px 5px; border-radius: 3px; font-size: 0.85em; vertical-align: middle; }
#pidStatus.on { background-color: #c3e6cb; border: 1px solid #28a745; color: #155724; }
#pidStatus:not(.on) { background-color: #f5c6cb; border: 1px solid #dc3545; color: #721c24; }
#pidStatus.manual { background-color: #ffeeba; border: 1px solid #ffc107; color: #856404; }

/* Slider value span styles */
.control-group label span { font-weight: normal; margin-left: 5px; color: #555; display: inline-block; min-width: 25px; text-align: right; font-size: 1em; line-height: 1; }

