/* Design System */
:root {
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-success: #4CAF50;
    --color-success-dark: #45a049;
    --color-error: #e74c3c;
    --color-text: #2c3e50;
    --color-text-light: #7f8c8d;
    --color-border: #ddd;
    --color-background: #f5f5f5;
    --shadow-default: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 6px;
    --spacing-unit: 1rem;
}

/* Global Styles */
body {
    font-family: var(--font-primary);
    background-color: var(--color-background);
    color: var(--color-text);
    margin: 0;
    padding: var(--spacing-unit);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Authentication Styles */
.hidden {
    display: none !important;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: calc(var(--spacing-unit) * 2);
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-default);
    margin: calc(var(--spacing-unit) * 2) auto;
    width: calc(100% - var(--spacing-unit) * 4);
    max-width: 400px;
    box-sizing: border-box;
}

.login-container h1 {
    color: var(--color-text);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.login-container p {
    color: var(--color-text-light);
    margin-bottom: var(--spacing-unit);
}

.error {
    color: var(--color-error);
    background-color: rgba(231, 76, 60, 0.1);
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    margin-top: var(--spacing-unit);
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
}

#content-section {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#user-email {
    color: var(--color-text);
    font-size: 0.9rem;
}

#logout-button {
    background-color: var(--color-error);
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}



/* Typography */
h1 {
    font-size: 3rem;
    margin: var(--spacing-unit) 0;
    color: var(--color-text);
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    margin: var(--spacing-unit) 0;
    color: var(--color-text);
}

p {
    color: var(--color-text-light);
    line-height: 1.6;
    margin: var(--spacing-unit) 0;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-unit);
    text-align: center;
    margin: var(--spacing-unit) 0;
    background-color: var(--color-background);
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone.dragover,
.drop-zone:hover {
    background-color: #e9ecef;
    border-color: var(--color-primary);
    border-style: solid;
}

/* Layout Components */
.container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-default);
    padding: calc(var(--spacing-unit) * 2);
    width: 100%;
    max-width: 1200px;
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--spacing-unit) * 2);
}

/* Editable Table Cells, including hover and focus states */
.editable-cell {
    position: relative;
    cursor: text;
    transition: all 0.2s ease;
}

.editable-cell:hover {
    background-color: var(--color-background);
}

.editable-cell:focus {
    outline: 2px solid var(--color-primary);
    background-color: white;
    box-shadow: var(--shadow-default);
}

/* Add a subtle "pencil" indicator that cells are editable */
.editable-cell::after {
    content: '✎';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.8em;
    opacity: 0;
    color: var(--color-primary);
    transition: opacity 0.2s ease;
}

.editable-cell:hover::after {
    opacity: 0.5;
}

/* Correlation Section */
.correlation-section .section-title {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.correlation-section {
    width: 100%;
    padding: 20px;
    margin-top: 20px;
    background-color: #f5f5f5;
}

#correlationMatrixContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 20px;
}

#correlationMatrix {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Plot Controls */
.plot-controls {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
    width: 100%;
    max-width: 800px;
}

/* X-axis row */
.x-axis-row {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 0.5);
}

.x-axis-row label {
    min-width: 2em;
}

.x-axis-row select {
    flex: 1;
    max-width: 400px;
}

/* Y-axes row */
.y-axes-row {
    display: flex;
    justify-content: flex-start;
}

.y-axes {
    display: flex;
    gap: calc(var(--spacing-unit) * 2);
}

.y-axis-group {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 0.5);
}

.y-axis-group label {
    min-width: 2em;
}

.y-axis-group select {
    width: 150px;
}

/* Button row */
.button-row {
    display: flex;
    justify-content: flex-start;
    margin-top: calc(var(--spacing-unit) * 0.5);
}

button, .btn {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--spacing-unit) / 2);
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover, .btn:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
}

button.add-button {
    background-color: var(--color-success);
}

button.add-button:hover {
    background-color: var(--color-success-dark);
}

/* Form Elements */
input, select {
    padding: calc(var(--spacing-unit) * 0.5);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-family: var(--font-primary);
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-unit) 0;
}

th, td {
    border: 1px solid var(--color-border);
    padding: calc(var(--spacing-unit) * 0.5);
    text-align: left;
}

th {
    background-color: var(--color-background);
    font-weight: 600;
}

/* Special Components */
.emoji {
    font-size: 4rem;
    margin: var(--spacing-unit) 0;
}

.error-code {
    font-size: 8rem;
    margin: 0;
    color: var(--color-error);
    line-height: 1;
}

.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80vh;
}

.button-group {
    display: flex;
    gap: var(--spacing-unit);
    justify-content: center;
    margin-top: var(--spacing-unit);
}

.plot-controls {
    margin: var(--spacing-unit) 0;
    display: flex;
    gap: var(--spacing-unit);
    align-items: center;
}

/* Utility Classes */
.mt-1 { margin-top: var(--spacing-unit); }
.mb-1 { margin-bottom: var(--spacing-unit); }
.text-center { text-align: center; }

/* Editable Column Headers */
#dataTable thead th {
    cursor: text;
    transition: background-color 0.3s ease;
}

#dataTable thead th:hover {
    background-color: #f0f0f0;
}

#dataTable thead th:focus {
    outline: 2px solid #007bff;
    background-color: #f9f9f9;
}
