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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffe5f0;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #ff9ec5 0%, #ff7eb3 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 15px;
    padding: 15px;
}

.editor-layout {
    display: grid;
    grid-template-columns: 600px 1fr;
    gap: 20px;
    margin-top: 0;
    height: calc(100vh - 200px);
    min-height: 600px;
}

.control-points-panel {
    background: #f8f9fa;
    padding: 15px;
    padding-bottom: 30px;
    border-radius: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    box-sizing: border-box;
}

.control-points-panel h3 {
    margin-bottom: 8px;
    color: #ff7eb3;
    font-size: 1.2em;
}

.plot-interface-panel {
    background: white;
    padding: 15px;
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.plot-interface-panel h2 {
    margin-bottom: 8px;
    color: #ff7eb3;
    font-size: 1.3em;
    margin-top: 0;
    flex-shrink: 0;
}

.plot-interface-panel .subtitle {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9em;
    flex-shrink: 0;
}

.plot-interface-panel .preset-buttons {
    margin-bottom: 15px;
    flex-shrink: 0;
}

.plot-interface-panel .plot-info {
    flex-shrink: 0;
}

.settings-panel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 15px;
}

.settings-panel h2 {
    margin-bottom: 12px;
    color: #ff7eb3;
    font-size: 1.2em;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.form-group input[type="number"],
.form-group input[type="time"],
.form-group select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff7eb3;
}

.form-group small {
    display: block;
    margin-top: 3px;
    color: #666;
    font-size: 0.7em;
    line-height: 1.3;
}

.checkbox-group {
    margin-top: 10px;
}

.checkbox-group label,
.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    margin-bottom: 8px;
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-group {
    margin-top: 10px;
}

.forced-options {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.calculated-days {
    margin-top: 10px;
    padding: 8px;
    background: #ffd6e8;
    border-radius: 4px;
    border: 1px solid #ffb3d1;
}

.calculated-days small {
    color: #ff6ba3;
    font-weight: 600;
}

.day-time-inputs {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.day-time-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.day-time-item label {
    min-width: 60px;
    font-weight: 600;
    color: #ff7eb3;
}

.day-time-item input {
    flex: 1;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.illuminance-panel {
    padding: 25px;
}

.illuminance-panel h2 {
    margin-bottom: 10px;
    color: #ff7eb3;
    font-size: 1.5em;
}

.subtitle {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 16px;
    background: #ff7eb3;
    color: white;
    font-size: 0.9em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.preset-btn:hover {
    background: #ff6ba3;
}

.view-toggle-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.view-toggle-btn {
    flex: 1;
    padding: 12px 20px;
    background: #ffe5f0;
    color: #ff7eb3;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.view-toggle-btn:hover {
    background: #ffd6e8;
}

.view-toggle-btn.active {
    background: #ff7eb3;
    color: white;
    border-color: #ff7eb3;
}

.view-section {
    transition: opacity 0.3s;
}

.plot-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.plot-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.point-info {
    font-weight: 600;
    color: #ff7eb3;
    padding: 8px 15px;
    background: white;
    border-radius: 6px;
    border: 2px solid #ff7eb3;
}

.plot-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 8px 15px;
    background: #ff4d7a;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.control-btn:hover {
    background: #ff3d6a;
}

.plots-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0; /* Allow flex shrinking */
}

.subplot-container {
    margin-bottom: 15px;
    margin-top: 10px;
}

.subplot-container:first-of-type {
    margin-top: 0;
}

.subplot-label {
    font-size: 0.9em;
    font-weight: 600;
    color: #ff7eb3;
    margin-bottom: 5px;
}

.plot-wrapper {
    position: relative;
    background: white;
    border: 3px solid #ffb3d1;
    border-radius: 8px;
    padding: 10px;
    transition: border-color 0.3s, box-shadow 0.3s;
    width: 100%;
    min-width: 0; /* Allow flex shrinking */
    box-sizing: border-box;
}

.plot-wrapper.active {
    border-color: #ff7eb3;
    box-shadow: 0 0 10px rgba(255, 126, 179, 0.3);
}

.plot-wrapper:hover {
    border-color: #ff7eb3;
}

.plot-day-label {
    font-weight: 600;
    font-size: 1.1em;
    color: #ff7eb3;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 2px solid #ff7eb3;
}

.combined-plot-container {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.combined-plot {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

.illuminance-plot {
    width: 100%;
    height: 250px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: crosshair;
    display: block;
}

.control-points-editor {
    margin-top: 30px;
}

.control-points-editor h3 {
    margin-bottom: 10px;
    color: #ff7eb3;
}

.subtitle-small {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.control-points-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    background: transparent;
}

.control-point-item {
    background: white;
    padding: 8px;
    border-radius: 6px;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.3s;
    flex-wrap: wrap;
    min-width: 0;
}

.control-point-item:hover {
    border-color: #ff7eb3;
}

.control-point-item.selected {
    border-color: #ff7eb3;
    background: #ffe5f0;
}

.control-point-item label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.75em;
    color: #666;
    min-width: 45px;
    flex-shrink: 0;
}

.control-point-item input,
.control-point-item select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
    min-width: 0;
    width: 80px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.control-point-item input:focus,
.control-point-item select:focus {
    outline: none;
    border-color: #ff7eb3;
}

.control-point-item .delete-btn {
    padding: 4px 8px;
    background: #ff4d7a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75em;
    margin-left: auto;
    flex-shrink: 0;
}

.control-point-item .delete-btn:hover {
    background: #ff3d6a;
}

.generate-section {
    padding: 30px;
    text-align: center;
    background: #ffe5f0;
    border-top: 1px solid #ffb3d1;
}

.generate-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #ff7eb3 0%, #ff9ec5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 126, 179, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

.output-panel {
    padding: 30px;
    background: #1e1e1e;
    color: #d4d4d4;
    border-top: 1px solid #333;
}

.output-panel h2 {
    color: #ff7eb3;
    margin-bottom: 20px;
}

.output-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.copy-btn,
.download-btn {
    padding: 10px 20px;
    background: #ff7eb3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.copy-btn:hover,
.download-btn:hover {
    background: #ff6ba3;
}

.output-code {
    background: #252526;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #3e3e42;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        position: static;
    }
}

