/* General Reset */
html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Ensure full height is applied to root elements */
    font-family: Arial, sans-serif;
}

/* Global Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ✅ Improve table appearance */
#summary-table-container {
    margin-top: 15px;
    font-size: 0.875rem; /* Smaller font size (14px-ish) */

}

#summary-table-container h5 {
    font-size: 1rem; /* Slightly smaller table headings if needed */
}

#summary-table-container tbody {
    font-size: 0.85rem;
}

#summary-table-container th {
    font-size: 0.875rem;
}

.table {
    border-collapse: collapse;
    width: 100%;
}

.table th, .table td {
    text-align: center;  /* ✅ Center-align values */
    padding: 10px;
    border: 1px solid #ddd;
}

.thead-dark th {
    background-color: #343a40 !important;
    color: white;
}

/* Container */
.container {
    display: flex;
    flex-wrap: wrap;          /* ✅ allow wrapping on narrow screens */
    justify-content: space-between;
    gap: 20px;
    width: 100%;              /* ✅ use full screen width */
    max-width: 100%;          /* ✅ remove 90% constraint */
    margin-left: auto;
    margin-right: auto;
}

/* Default markdown layout for most screens */
.container.markdown-container {
  max-width: 100%;
  margin: 0;
  padding: 0 20px;
}

/* Compact and clean markdown styling */
.markdown-content {
    font-family: Georgia, serif !important;
    font-size: 14px;
    line-height: 1.4;
    background-color: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 16px;  /* slightly tighter internal padding */
}

.markdown-content figure,
.markdown-content h2,
.markdown-content h1,
.markdown-content p {
  display: block;
  width: 100%;
  clear: both;
}

.markdown-content img {
  display: block;
  margin: 0 auto;
}

.markdown-content figcaption {
  text-align: center;
  font-style: italic;
  margin-top: 0.5em;
}

.markdown-content table {
  display: table;
  margin-left: auto;
  margin-right: auto;
  width: auto; /* ✅ Overrides Bootstrap's 100% width */
}

table {
  display: table;
  margin-left: auto;
  margin-right: auto;
}

/* Match tab font to content */
.nav-tabs .nav-link {
    font-family: Georgia, serif;
}

/* Headers */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: #333;
    margin-top: 0.5rem;
    margin-bottom: 0.3rem;
    text-align: left !important;
}

/* Paragraphs */
.markdown-content p {
    margin-top: 0;
    margin-bottom: 0.4rem;  /* restore just enough vertical space */
}

/* Lists */
.markdown-content ul,
.markdown-content ol {
    margin-top: 0;
    margin-bottom: 0.4rem;
    padding-left: 1.2rem;
}

.markdown-content * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Tabs */
.tabs {
    display: flex;
    background-color: #f8f9fa; /* Light Bootstrap gray */
    padding: 10px;
    border-bottom: 1px solid #dee2e6; /* Bootstrap border color */
}

.tabs button {
    background-color: #e9ecef; /* Bootstrap light gray */
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 5px;
    border-radius: 0.25rem; /* Bootstrap-style rounded corners */
}

.tabs button.active {
    background-color: #0d6efd; /* Bootstrap primary color */
    color: white;
}

.tab-content {
    overflow: visible;
    height: auto;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ✅ General Control Panel Styling */
.control-panel {
    flex: 0 0 220px;  /* Consistent width for both panels */
    max-width: 220px;
    height: auto;
    padding: 12px;
    background-color: #f8f9fa; /* Light background for readability */
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    font-family: inherit;
}


/* ✅ Ensure uniform styling across inputs, dropdowns, and buttons */
.control-panel select,
.control-panel button,
.control-panel input {
    font-size: 14px;
    padding: 4px 6px;
    width: 100%;  /* Ensure elements take full width */
}

/* ✅ Keep spacing compact */
.control-panel .form-control {
    margin-bottom: 6px;
}

/* ✅ Heading Styles */
.control-panel h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

/* 🔹 Slight Variation for Summary Control Panel (if needed) */
.summary-panel {
    background-color: #eef2f6; /* Subtle background color difference */
}

/* Plot Panel Styling */
.plot-panel {
  flex-grow: 1;
  flex-basis: 0;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px;
}

.graph-container:last-child {
    margin-bottom: 0;
    font-family: inherit;
}

.graph-container p.text-muted {
    text-align: center;
    font-style: italic;
    color: #6c757d;
    margin-top: 16px;
}

.info-icon {
    font-size: 14px;
    font-weight: bold;
    color: #007bff; /* Bootstrap primary blue */
    cursor: pointer;
    margin-left: 5px;
}

.plot-container {
  width: 100%;
}

#raw-plot, #ratio-plot {
    width: 100%;
    min-width: 0;
    min-height: 500px !important;
    display: block !important;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .container {
        flex-direction: column; /* Stack control and plot panels vertically */
        align-items: center; /* Ensure everything centers properly */
    }

    .control-panel {
        width: 100%; /* Full width */
        max-width: 100%;
        margin-bottom: 15px; /* Reduce margin */
        padding: 10px;
    }

    .plot-panel {
        width: 100%;
        min-width: 0;
        padding: 0 5px;
    }

    .graph-container {
        width: 100%;
        min-width: 0;
    }
}

/* Larger screen override for readability */
@media screen and (min-width: 992px) {
    .container.markdown-container {
        max-width: 1000px;
    }
}

/* Buttons */
input[type="submit"],
button {
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    background-color: #0d6efd; /* Bootstrap primary */
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

input[type="submit"]:hover,
button:hover {
    background-color: #0056b3; /* Bootstrap primary dark */
}

/* Ensure the row is a flex container */
.row.custom-flex-row {
    display: flex; /* ✅ Ensures side-by-side layout */
    flex-wrap: nowrap; /* ✅ Prevents wrapping to the next line */
    align-items: flex-start; /* ✅ Aligns both panels at the top */
    gap: 20px; /* ✅ Adds spacing */
}

figure {
  display: block;
  clear: both;
  margin-top: 1em;
  margin-bottom: 1em;
}

figure img {
  display: block;
  margin: 0 auto;
}

figcaption {
  text-align: center;
  font-style: italic;
}

h2 {
  display: block;
  margin-top: 2em;
}