* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    font-weight: 200;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.light {
    background-color: white;
    color: black;
}

body.dark {
    background-color: black;
    color: white;
}

#dark-light {
    position: fixed;
    top: 5px;
    right: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 100;
}

#container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Section oscilloscope (gauche) */
#oscilloscope-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
    transition: background-color 0.3s ease;
}

body.dark #oscilloscope-section {
    background-color: var(--grey5);
}

body.light #oscilloscope-section {
    background-color: white;
}

#oscilloscope-container {
    flex: 1;
    border: 3px solid var(--grey3);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 5px;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark #oscilloscope-container {
    background-color: #000000;
}

body.light #oscilloscope-container {
    background-color: white;
    border-color: var(--grey2);
}

#oscilloscope {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* Contrôles du signal */
#signal-controls {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    min-height: 100px;
    transition: background-color 0.3s ease;
}

body.dark #signal-controls {
    background-color: var(--grey4);
}

body.light #signal-controls {
    background-color: var(--grey0);
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.control-group label {
    font-size: 12px;
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

body.dark .control-group label {
    color: var(--grey1);
}

body.light .control-group label {
    color: var(--grey3);
}

.control-group input,
.control-group select {
    padding: 8px;
    border: 1px solid var(--grey3);
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.dark .control-group input,
body.dark .control-group select {
    background-color: var(--grey5);
    color: white;
}

body.light .control-group input,
body.light .control-group select {
    background-color: white;
    color: black;
}

.control-group input[type="file"] {
    padding: 5px;
}

.regenerate-button {
    padding: 10px 20px;
    border: 2px solid var(--orange1);
    background-color: transparent;
    color: var(--orange1);
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
}

.regenerate-button:hover {
    background-color: var(--orange1);
    color: white;
}

body.light .regenerate-button {
    border-color: var(--orange1);
    color: var(--orange1);
}

body.light .regenerate-button:hover {
    background-color: var(--orange1);
    color: white;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--orange1);
}

.control-group input[type="number"] {
    cursor: ew-resize;
    user-select: none;
}

.control-group input[type="number"].dragging {
    background-color: var(--orange3);
    border-color: var(--orange1);
    color: white;
}

/* Menus de l'oscilloscope */
#oscilloscope-menus {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

body.dark #oscilloscope-menus {
    background-color: var(--grey4);
}

body.light #oscilloscope-menus {
    background-color: var(--grey0);
}

.menu-group {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

body.dark .menu-group {
    background-color: var(--grey5);
}

body.light .menu-group {
    background-color: white;
}

.menu-group h3 {
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 400;
}

/* Thème vert pour l'entrée */
.menu-group:nth-child(1) h3 {
    color: var(--green1);
}

body.dark .menu-group:nth-child(1) {
    border-left: 3px solid var(--green2);
}

body.light .menu-group:nth-child(1) {
    border-left: 3px solid var(--green1);
}

/* Thème orange pour la sortie */
.menu-group:nth-child(2) h3 {
    color: var(--orange1);
}

body.dark .menu-group:nth-child(2) {
    border-left: 3px solid var(--orange2);
}

body.light .menu-group:nth-child(2) {
    border-left: 3px solid var(--orange1);
}

/* Thème bleu pour horizontal */
.menu-group:nth-child(3) h3 {
    color: var(--blue1);
}

body.dark .menu-group:nth-child(3) {
    border-left: 3px solid var(--blue2);
}

body.light .menu-group:nth-child(3) {
    border-left: 3px solid var(--blue1);
}

.menu-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
}

.menu-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--green1);
}

/* Couleurs spécifiques pour chaque menu */
.menu-group:nth-child(1) input[type="checkbox"] {
    accent-color: var(--green1);
}

.menu-group:nth-child(2) input[type="checkbox"] {
    accent-color: var(--orange1);
}

.menu-group:nth-child(3) input[type="checkbox"] {
    accent-color: var(--blue1);
}

.zoom-control {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.zoom-control label {
    font-size: 11px;
}

body.dark .zoom-control label {
    color: var(--grey1);
}

body.light .zoom-control label {
    color: var(--grey3);
}

.zoom-control input[type="range"] {
    width: 100%;
    cursor: pointer;
}

/* Couleurs pour les sliders de chaque menu */
.menu-group:nth-child(1) input[type="range"] {
    accent-color: var(--green1);
}

.menu-group:nth-child(2) input[type="range"] {
    accent-color: var(--orange1);
}

.menu-group:nth-child(3) input[type="range"] {
    accent-color: var(--blue1);
}

.zoom-control span {
    font-size: 12px;
    text-align: center;
    font-weight: bold;
}

/* Couleurs pour les valeurs des menus */
.menu-group:nth-child(1) .zoom-control span {
    color: var(--green1);
}

.menu-group:nth-child(2) .zoom-control span {
    color: var(--orange1);
}

.menu-group:nth-child(3) .zoom-control span {
    color: var(--blue1);
}

/* Handles de redimensionnement */
.resize-handle-vertical {
    width: 5px;
    cursor: ew-resize;
    transition: background-color 0.2s;
    position: relative;
}

body.dark .resize-handle-vertical {
    background-color: var(--grey3);
}

body.light .resize-handle-vertical {
    background-color: var(--grey2);
}

.resize-handle-vertical:hover {
    background-color: var(--orange1);
}

.resize-handle-horizontal {
    height: 5px;
    cursor: ns-resize;
    transition: background-color 0.2s;
    margin: 5px 0;
}

body.dark .resize-handle-horizontal {
    background-color: var(--grey3);
}

body.light .resize-handle-horizontal {
    background-color: var(--grey2);
}

.resize-handle-horizontal:hover {
    background-color: var(--orange1);
}

/* Section filtres (droite) */
#filter-section {
    width: 400px;
    min-width: 200px;
    padding: 20px;
    overflow-y: auto;
    transition: background-color 0.3s ease;
}

body.dark #filter-section {
    background-color: var(--grey4);
}

body.light #filter-section {
    background-color: var(--grey0);
}

#filter-section h2 {
    font-size: 20px;
    color: var(--orange1);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 400;
}

.filter-controls {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

body.dark .filter-controls {
    background-color: var(--grey5);
}

body.light .filter-controls {
    background-color: white;
}

.filter-controls .control-group {
    margin-bottom: 15px;
}

.helper-text {
    font-size: 11px;
    color: var(--grey2);
    margin-top: 5px;
}

/* Informations sur le filtre */
#filter-info {
    padding: 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

body.dark #filter-info {
    background-color: var(--grey5);
}

body.light #filter-info {
    background-color: white;
}

#filter-info h3 {
    font-size: 14px;
    color: var(--orange1);
    margin-bottom: 10px;
    font-weight: 400;
}

.math-display {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    min-height: 60px;
    line-height: 1.6;
    text-align: center;
    transition: background-color 0.3s ease;
}

body.dark .math-display {
    background-color: #000000;
    border: 1px solid var(--grey3);
}

body.light .math-display {
    background-color: #f5f5f5;
    border: 1px solid var(--grey2);
}

/* Scrollbar personnalisée */
#filter-section::-webkit-scrollbar {
    width: 8px;
}

body.dark #filter-section::-webkit-scrollbar-track {
    background: var(--grey5);
}

body.light #filter-section::-webkit-scrollbar-track {
    background: var(--grey0);
}

body.dark #filter-section::-webkit-scrollbar-thumb {
    background: var(--grey3);
    border-radius: 4px;
}

body.light #filter-section::-webkit-scrollbar-thumb {
    background: var(--grey2);
    border-radius: 4px;
}

body.dark #filter-section::-webkit-scrollbar-thumb:hover {
    background: var(--grey2);
}

body.light #filter-section::-webkit-scrollbar-thumb:hover {
    background: var(--grey3);
}

/* Responsive */
@media (max-width: 1200px) {
    #container {
        flex-direction: column;
    }

    #filter-section {
        width: 100%;
        max-height: 40vh;
    }

    #oscilloscope-section {
        border-right: none;
    }
}
