/* Scaling Explorer styles */

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

body {
    background: var(--bg-warm, #f5f5f5);
    color: var(--text-primary, #2d2d2d);
    font-family: 'EB Garamond', Georgia, serif;
    min-height: 100vh;
}

.content {
    max-width: 1100px;
    margin: 0 auto;
    padding: calc(var(--header-height, 64px) + 2rem) 1.5rem 3rem;
}

.intro h1 {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.intro p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-muted, #6b6b6b);
    margin-bottom: 1.5rem;
}

/* App layout: image left (2/3), controls+plot right (1/3) */
.app-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

/* Canvas area: 2/3 width */
.canvas-area {
    flex: 2;
    min-width: 0;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

#main-canvas {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: pixelated;
}

.drop-hint {
    position: absolute;
    bottom: 0.75rem;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    pointer-events: none;
    transition: opacity 0.3s;
}

.canvas-wrapper.drag-over .drop-hint {
    color: rgba(255,255,255,0.9);
}

.canvas-wrapper.drag-over {
    outline: 2px dashed rgba(255,255,255,0.6);
}

/* Right column: controls + plot */
.controls-column {
    flex: 1;
    min-width: 260px;
    max-width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Controls panel */
.controls-panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.82rem;
}

.controls-body {
    padding: 0.75rem 0.9rem;
}

.control-group {
    margin-bottom: 0.7rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary, #2d2d2d);
    font-size: 0.82rem;
}

.control-group label span {
    font-weight: 600;
}

/* Select */
.control-group select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.82rem;
    background: #fff;
    color: var(--text-primary, #2d2d2d);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
}

.control-group select:focus {
    border-color: #888;
}

/* Range sliders */
input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #ccc, #888);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    accent-color: #2196F3;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 2px solid #2196F3;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: border-color 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    border-color: #1565C0;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 2px solid #2196F3;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.control-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 0.7rem 0;
}

/* Toggle button group */
.toggle-group {
    display: flex;
    gap: 0;
    margin-top: 0.25rem;
}

.toggle-btn {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: inherit;
    color: var(--text-muted, #6b6b6b);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.toggle-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.toggle-btn:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.toggle-btn.active {
    background: var(--text-primary, #2d2d2d);
    color: #fff;
    border-color: var(--text-primary, #2d2d2d);
}

/* Action buttons row */
.button-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.action-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-primary, #2d2d2d);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.primary {
    background: #2196F3;
    color: #fff;
    border-color: #2196F3;
}

.action-btn.primary:hover:not(:disabled) {
    background: #1976D2;
    border-color: #1976D2;
}

.action-btn:hover:not(:disabled):not(.primary) {
    background: #f0f0f0;
}

/* Mode-specific control sections */
.mode-controls {
    display: none;
}

.mode-controls.active {
    display: block;
}

/* Plot panel */
.plot-panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.plot-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #6b6b6b);
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.circle-count {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted, #6b6b6b);
    margin-bottom: 0.35rem;
    min-height: 1em;
}

#plot-canvas {
    width: 100%;
    height: 200px;
    display: block;
    border-radius: 4px;
}

.slope-label {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary, #2d2d2d);
    margin-top: 0.4rem;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    min-height: 1.2em;
}

.status-yes {
    color: #1b8e3e;
}

.status-somewhat {
    color: #b8860b;
}

.status-no {
    color: #c62828;
}

/* About section collapsible */
.about-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.about-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.8rem;
    color: var(--text-muted, #6b6b6b);
    text-align: left;
    cursor: pointer;
    transition: color 0.15s ease;
}

.about-toggle:hover {
    color: var(--text-primary, #2d2d2d);
}

.about-toggle.open {
    border-bottom: 1px solid #e0e0e0;
}

.about-label { font-weight: 500; }

.about-arrow {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.about-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 1rem;
}

.about-content.open {
    max-height: 800px;
    padding: 0.75rem 1rem 1rem;
}

.about-content p {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    color: var(--text-primary, #2d2d2d);
}

.about-content p:last-child { margin-bottom: 0; }

.about-content a {
    color: inherit;
    text-decoration: underline;
}

.about-content a:hover { text-decoration: none; }

/* Mobile layout */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .canvas-area {
        order: 0;
        flex: none;
        width: 100%;
    }

    .controls-column {
        order: 1;
        max-width: 100%;
        width: 100%;
    }
}
