:root {
    --hydronix-blue: #00509d;
    --hydronix-blue-hover: #003d7a;
    --light-gray: #f4f4f4;
    --border-color: #ddd;
    --text-color: #333333;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body,
html {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-color);
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background-color: white;
}

body {
    display: flex;
}

.sidebar {
    width: 320px;
    background-color: var(--light-gray);
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
}

.logo-container img {
    max-width: 180px;
    display: block;
}

hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 20px 0;
}

.sub-hr {
    margin: 15px 0;
    border-top: 1px dashed #ccc;
}

.control-group {
    background-color: var(--light-gray);
    margin-bottom: 25px;
}

.control-group h3 {
    margin-top: 0;
    font-size: 0.95rem;
    color: #444;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Drag and Drop Zone */
.drop-zone {
    border: 2px dashed #bbb;
    border-radius: 8px;
    padding: 30px 10px;
    text-align: center;
    background-color: white;
    position: relative;
    transition: all 0.2s;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--hydronix-blue);
    background-color: #f0f7ff;
}

.drop-zone p {
    margin: 10px 0 0 0;
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.drop-icon {
    font-size: 2rem;
    color: #999;
}

.drop-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* File Info Box */
.file-info {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    margin-top: 10px;
}

.file-icon {
    font-size: 1.5rem;
    margin-right: 10px;
}

.file-details {
    flex-grow: 1;
    overflow: hidden;
}

.file-name {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    display: block;
    font-size: 0.75rem;
    color: #888;
}

.clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #999;
}

.clear-btn:hover {
    color: #d32f2f;
}

/* Metadata Container */
details {
    background-color: #eef2f5;
    border: 1px solid #d0d7e0;
    border-radius: 6px;
    margin-top: 10px;
}

summary {
    padding: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    list-style: none;
    /* Hide default arrow in some browsers */
    display: flex;
    align-items: center;
}

summary::before {
    content: "▶";
    font-size: 0.7rem;
    margin-right: 8px;
    color: var(--hydronix-blue);
    transition: transform 0.2s;
}

details[open] summary::before {
    transform: rotate(90deg);
}

.metadata-content {
    padding: 10px 15px 15px 15px;
    border-top: 1px solid #d0d7e0;
    font-size: 0.8rem;
    line-height: 1.5;
    background-color: #f7f9fa;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    max-height: 250px;
    overflow-y: auto;
}

.metadata-content p {
    margin: 4px 0;
    border-bottom: 1px dashed #e0e0e0;
    padding-bottom: 4px;
}

.metadata-content strong {
    color: #444;
}

/* Form Elements */
.hydronix-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.filter-toggle {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.filter-toggle input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.filter-toggle label {
    font-weight: 500;
    color: #333;
    display: inline;
}

.filter-params {
    padding-left: 25px;
    margin-bottom: 15px;
}

label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: #555;
    font-weight: normal;
}

.val-display {
    color: var(--hydronix-blue);
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    margin-bottom: 15px;
    accent-color: var(--hydronix-blue);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    width: calc(100% - 320px);
    /* Explicitly calculate width if flex-grow gets squeezed */
}

/* Hide PyScript configuration/script tags from layout flow */
py-script,
py-config {
    display: none !important;
}

.hydronix-header {
    background-color: var(--hydronix-blue);
    color: white;
    padding: 15px 30px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 20px;
    border-radius: 4px;
}

.hydronix-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
}

.warning-banner {
    background-color: #fff8e1;
    border: 1px solid #ffe082;
    color: #f57f17;
    padding: 10px 20px;
    margin: 0 20px 20px 20px;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.chart-container {
    flex: 1 1 auto;
    background: white;
    margin: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
}

#plotlyChart {
    width: 100%;
    flex: 1;
    min-height: 400px;
}

.metrics-container {
    display: flex;
    gap: 30px;
    margin: 0 40px 30px 40px;
    flex: 0 0 auto;
}

.metric-card {
    flex: 1;
    background: transparent;
    padding: 10px 0;
}

.metric-card h4 {
    margin: 0 0 5px 0;
    color: #666;
    font-size: 0.85rem;
    font-weight: normal;
}

.metric-card span {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
}

.status-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    background-color: #e8f4fd;
    color: var(--hydronix-blue);
    border: 1px solid #b3d7ff;
}

.status-error {
    background-color: #fde8e8;
    color: #d32f2f;
    border-color: #ffb3b3;
}