/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Title Panel */
.title-panel {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

.app-title {
    font-size: 2.5em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.app-subtitle {
    color: #555;
    font-weight: 400;
}

.app-subtitle a {
    color: #3498db;
    text-decoration: none;
}

.app-subtitle a:hover {
    text-decoration: underline;
}

/* Guiding Questions Panel */
.guiding-questions {
    background-color: #e8f4f8;
    border-left: 4px solid #5bc0de;
    padding: 15px;
    margin: 15px 0 25px 0;
    border-radius: 0 4px 4px 0;
}

.guiding-questions h4 {
    color: #31708f;
    margin-top: 0;
    font-weight: 600;
}

.guiding-questions p {
    color: #31708f;
    margin-bottom: 8px;
}

/* Main Layout */
.main-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* Sidebar */
.sidebar {
    width: 350px;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 25px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 0;
    overflow: hidden;
}

.section-header {
    background-color: #2c3e50;
    color: white;
    padding: 10px 15px;
    margin: 0;
    font-weight: 600;
    font-size: 1.15em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subsection-focus {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 15px;
    margin: 15px;
    border-left: 3px solid #3498db;
}

.subsection-header {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.05em;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #3498db;
    position: relative;
    padding-left: 12px;
}

.subsection-header:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 5px;
    width: 4px;
    background-color: #3498db;
    border-radius: 2px;
}

/* Form Controls */
label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 8px;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.help-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    margin-bottom: 0;
}

/* Sample Size Panel */
.sample-size-panel {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 0;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.help-block {
    padding: 15px;
    margin: 0;
    color: #555;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-info {
    background-color: #5bc0de;
    color: white;
    margin: 5px;
}

.btn-info:hover {
    background-color: #46b8da;
}

/* Main Panel */
.main-panel {
    flex: 1;
    min-width: 0;
}

.result-text {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

.preformatted {
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
}

/* Visualizations */
#plotDistribution, #plotCombined, #plotData {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 30px;
    min-height: 400px;
}

/* Code Display */
.code-section {
    margin: 30px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.code-display {
    margin-top: 15px;
    padding: 15px;
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    font-size: 0.9em;
    overflow-x: auto;
}

/* Export Section */
.export-section {
    margin: 30px 0;
}

.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Footer */
.footer-divider {
    margin: 40px 0 20px 0;
    border: none;
    border-top: 1px solid #dee2e6;
}

.footer {
    text-align: center;
    color: #777;
    font-size: 0.9em;
}

.footer a {
    color: #3498db;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 968px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    #plotDistribution, #plotCombined, #plotData {
        min-height: 300px;
    }
}

/* Error Messages */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}

/* Collapsible Sections */
.collapsible {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.collapsible:hover {
    background-color: #34495e;
}

.toggle-icon {
    float: right;
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.collapsible.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* Initial collapsed state */
.section-content.collapsed,
.collapsible.collapsed {
    /* Collapsed styles applied via class */
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    display: block;
}

.section-content:not(.collapsed) {
    max-height: 5000px;
}

.section-content.collapsed {
    max-height: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

.sidebar-section .section-content {
    padding: 15px;
}

.sample-size-panel .section-content {
    padding: 15px;
}

.output-section {
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    overflow: hidden;
}

.output-section .section-content {
    padding: 0;
}

/* Compact settings styles */
.compact-setting {
    margin-bottom: 12px;
}

.compact-setting:last-child {
    margin-bottom: 0;
}

.compact-setting label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9em;
    font-weight: 500;
    color: #555;
}

.compact-input {
    padding: 6px 10px;
    font-size: 0.95em;
    margin-bottom: 0;
}

.compact-divider {
    margin: 15px 0;
    border: none;
    border-top: 1px solid #dee2e6;
}

.compact-btn {
    width: 100%;
    padding: 8px 16px;
    margin-top: 10px;
    font-size: 0.9em;
}

.compact-result {
    margin-top: 10px;
    padding: 8px;
    font-size: 0.9em;
}

/* Remove subsection styling from compact mode */
.sidebar-section .section-content .subsection-focus {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.sidebar-section .section-content .subsection-header {
    display: none;
}

.sidebar-section .section-content .help-text {
    display: none;
}

