:root {
    --bg: #f8fafc;
    --text: #1e293b;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    margin: 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overscroll-behavior: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex: 1;
}

.header, .content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
    padding: 2rem;
}

.header {
    text-align: left;
}

.header h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 1rem;
}

.header p {
    color: #444;
    font-size: clamp(0.9rem, 2vw, 1rem);
    margin-bottom: 1rem;
    max-width: 800px;  
}

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

.content {
    display: flex;
    gap: 2rem;
}

.controls {
    width: 300px;
    padding: 1rem;
    flex-shrink: 0;
}

.visualization {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    width: auto;
    height: auto;
    max-width: 100%;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    background: var(--bg);
    border-radius: 8px;
}

.control-group {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 400;
    margin: 0 0.5rem 0 0;
    flex-shrink: 0;
    min-width: 65px;
}

.control-group input[type="range"],
.control-group input[type="number"] {
    margin: 0;
}

.control-group input[type="number"] {
    width: 45px;
    flex-shrink: 0;
}

.units-selector span,
.units-selector label {
    font-size: 0.9rem;
    font-weight: 400;
    margin-right: 0.5rem;
}

.units-selector input[type="radio"] {
    margin: 0;
    vertical-align: middle;
}

label {
    display: block;
    margin-bottom: 0.5rem;
}

.output-controls {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.full-width-button {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.full-width-button.secondary {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #666;
}

.full-width-button.secondary:hover {
    background-color: #e0e0e0;
}

input[type="range"] {
    width: calc(100% - 70px);
    margin-right: 0.5rem;
}

input[type="number"] {
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
}

.units-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.units-selector label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    gap: 0.25rem;
}

.units-selector input[type="radio"] {
    margin: 0;
}

button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

button:hover {
    background: #1d4ed8;
}

.footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: #666;
}

.advanced-settings-container {
    margin-top: 1rem;
}

/* Toggle button for advanced settings */
.toggle-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    margin: 10px 0;
    background-color: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.toggle-button:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
    color: #666;
}

.toggle-button.active {
    background-color: #f0f0f0;
    border-color: #ccc;
    color: #666;
}

.toggle-icon {
    transition: transform 0.3s;
}

.toggle-button.active .toggle-icon {
    transform: rotate(180deg);
}

.advanced-settings-panel {
    background: #f9f9f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.8rem;
    margin-top: 0.5rem;
    display: none;
    overflow: hidden;
    position: absolute;
    width: calc(100% - 2rem);
    z-index: 10;
    box-shadow: 0 4px 6px var(--shadow);
}

.advanced-settings-panel.active {
    display: block;
}

.advanced-settings-panel h4 {
    font-size: 0.9rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #444;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3rem;
}

.settings-section {
    margin-bottom: 1rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.advanced-settings-panel .control-group {
    margin-bottom: 0.5rem;
}

.advanced-settings-panel small {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
    margin-left: 0.5rem;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Modal notification system */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-dialog {
    transform: translateY(0);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #ff5252;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-message {
    margin-bottom: 15px;
}

.modal-list {
    padding-left: 25px;
    margin: 10px 0;
}

.modal-list li {
    margin-bottom: 8px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.modal-button.secondary {
    background-color: #f0f0f0;
    color: #333;
}

.modal-button.secondary:hover {
    background-color: #e0e0e0;
}

.modal-button.primary {
    background-color: #4caf50;
    color: white;
}

.modal-button.primary:hover {
    background-color: #3d8b40;
}

.modal-button.danger {
    background-color: #ff5252;
    color: white;
}

.modal-button.danger:hover {
    background-color: #e04545;
}

/* Notification system */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    z-index: 1000;
}

.notification {
    background-color: #fff;
    border-left: 4px solid #ff5252;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 4px;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.3s, transform 0.3s;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #ff5252;
}

.notification-message {
    color: #333;
    margin-bottom: 10px;
}

.notification-list {
    padding-left: 20px;
    margin: 5px 0;
}

.notification-close {
    background: none;
    border: none;
    color: #999;
    float: right;
    cursor: pointer;
    font-size: 16px;
    margin-top: -5px;
}

.notification-close:hover {
    color: #333;
}

.notification-actions {
    text-align: right;
    margin-top: 10px;
}

.notification-button {
    background-color: #f0f0f0;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 5px;
    font-size: 12px;
}

.notification-button:hover {
    background-color: #e0e0e0;
}

.notification-button.primary {
    background-color: #4caf50;
    color: white;
}

.notification-button.primary:hover {
    background-color: #3d8b40;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .content {
        flex-direction: column;
    }

    .controls {
        width: 100%;
        order: 2;
    }

    .visualization {
        order: 1;
    }

    .header, .content {
        padding: 1rem;
    }
}
