/**
 * style.css
 * Styling for the 1D Estuary Simulator
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

#app {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

header p {
    font-size: 14px;
    color: #cbd5e0;
}

.home-button,
.playground-button {
    position: absolute;
    top: 20px;
    color: white;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-button {
    right: 30px;
}

.playground-button {
    right: 80px;
}

.home-button:hover,
.playground-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
    position: relative;
}

/* Controls Section - 3 column layout */
#controls-section {
    padding: 20px;
    background: #edf2f7;
    border-top: 2px solid #e2e8f0;
}

#controls-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#controls-header h3 {
    font-size: 20px;
    color: #2d3748;
    margin: 0;
}

#controls-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

#controls-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #cbd5e0;
}

#export-container {
    display: flex;
    justify-content: center;
}

.controls-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.controls-column h4 {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #cbd5e0;
}

/* Visualization Section - Dual stacked views */
#visualization-section {
    padding: 20px;
    background: #f7fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#temp-canvas-container,
#sal-canvas-container {
    max-width: 1000px;
    margin-bottom: 5px;
}

#temp-canvas-container {
    margin-top: 0;
}

#sal-canvas-container {
    margin-top: 15px;
}

.colorbar-wrapper {
    width: 100%;
    max-width: 1000px;
    margin-bottom: 15px;
}

.colorbar-controls-horizontal {
    background: #f7fafc;
    border-radius: 6px;
    padding: 8px 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.colorbar-display {
    flex: 1;
    min-width: 200px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #cbd5e0;
}

#temp-colorbar-display {
    background: linear-gradient(to right,
            rgb(0, 0, 255),
            /* Blue */
            rgb(0, 255, 255),
            /* Cyan */
            rgb(0, 255, 0),
            /* Green */
            rgb(255, 255, 0),
            /* Yellow */
            rgb(255, 0, 0)
            /* Red */
        );
}

#sal-colorbar-display {
    background: linear-gradient(to right,
            rgb(0, 0, 255),
            /* Blue (Fresh) */
            rgb(0, 255, 255),
            /* Cyan */
            rgb(255, 255, 0),
            /* Yellow */
            rgb(139, 69, 19)
            /* Brown (Salty) */
        );
}

.colorbar-auto-label {
    font-size: 11px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    cursor: pointer;
    min-width: 55px;
}

.colorbar-auto-label input[type="checkbox"] {
    cursor: pointer;
}

.slider-value {
    font-size: 11px;
    font-weight: 600;
    color: #667eea;
    min-width: 45px;
    text-align: center;
}

.colorbar-controls-horizontal input[type="range"] {
    width: 120px;
    height: 6px;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: #cbd5e0;
    cursor: pointer;
}

.colorbar-controls-horizontal input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.colorbar-controls-horizontal input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.colorbar-controls-horizontal input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.colorbar-controls-horizontal input[type="range"]:disabled::-webkit-slider-thumb {
    background: #a0aec0;
    cursor: not-allowed;
}

.colorbar-controls-horizontal input[type="range"]:disabled::-moz-range-thumb {
    background: #a0aec0;
    cursor: not-allowed;
}

#controls-panel {
    background: #edf2f7;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

#controls-panel h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #2d3748;
    border-bottom: 2px solid #4a5568;
    padding-bottom: 8px;
}

#sliders-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-item span {
    font-size: 13px;
    color: #2d3748;
    font-weight: 500;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.control-label-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: #cbd5e0;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    cursor: help;
    transition: background 0.2s;
}

.help-icon:hover {
    background: #718096;
}

.control-value {
    color: #4a5568 !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    /* Remove margin-left as we use space-between now */
    margin-left: 0 !important;
}

.slider {
    width: 100%;
    margin-top: 5px;
    margin-bottom: 5px;
    height: 6px;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: #cbd5e0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider:hover::-webkit-slider-thumb {
    background: #5a67d8;
}

.slider:hover::-moz-range-thumb {
    background: #5a67d8;
}

.toggle-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #cbd5e0;
    background: white;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.toggle-select:hover {
    border-color: #667eea;
}

.toggle-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.button-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.separator {
    height: 2px;
    background: #cbd5e0;
    margin: 10px 0;
}

.control-button {
    padding: 10px 20px;
    background: #718096;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1;
}

.control-button:hover {
    background: #4a5568;
}

.control-button:active {
    transform: translateY(1px);
}

.primary-button {
    background: #48bb78 !important;
}

.primary-button:hover {
    background: #38a169 !important;
}

/* Profile Section */
#profile-section {
    padding: 20px;
    background: #f7fafc;
    border-top: 2px solid #e2e8f0;
}

#profile-section h3 {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 15px;
}

#profile-charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Velocity Section */
#velocity-section {
    padding: 20px;
    background: #f7fafc;
    border-top: 2px solid #e2e8f0;
}

#velocity-section h3 {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 15px;
}

#velocity-charts-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.chart-wrapper {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    height: 400px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}


/* Responsive design */
/* Responsive design */
@media (max-width: 1000px) {
    #profile-charts-container {
        grid-template-columns: 1fr;
    }

    #velocity-charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #controls-grid {
        grid-template-columns: 1fr;
    }
}

/* p5.js canvas styling */
canvas {
    display: block;
    border-radius: 6px;
}

/* Keyboard shortcuts info (optional) */
.shortcuts-info {
    font-size: 11px;
    color: #718096;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #cbd5e0;
}

.shortcuts-info p {
    margin: 3px 0;
}

/* New controls styles */
.control-label-header {
    font-weight: 600;
    font-size: 14px !important;
    color: #2d3748 !important;
    display: block;
    margin-bottom: 8px;
}

.colorbar-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.colorbar-input {
    width: 60px;
    padding: 5px;
    border: 2px solid #cbd5e0;
    border-radius: 4px;
    font-size: 12px;
}

.colorbar-input:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.preset-button {
    padding: 8px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.preset-button:hover {
    background: #5a67d8;
}

.preset-button:active {
    transform: translateY(1px);
}

/* Help Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
}

.modal-close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 25px;
    color: #2d3748;
    line-height: 1.6;
    font-size: 15px;
}