/* Modern UI Styling */
:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --accent-color: #2ecc71;
    --accent-color-dark: #1b7942;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    height: fit-content;
    width: 300px;
    position: relative;
}

.header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.control-group {
    margin-bottom: 20px;
}

.control-group h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-weight: 500;
}

.control-item {
    margin-bottom: 12px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 500;
}

label.checkbox-label {
    display: inline;
}

select,
input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 0.9rem;
}

select {
    cursor: pointer;
}

input[type="range"] {
    padding: 0;
}

.value-display {
    margin-left: 8px;
    font-size: 0.9rem;
}

.param-description {
    font-size: 0.8rem;
    color: #666;
    margin-top: 3px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.coordinate-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.coordinate-input-group {
    display: flex;
    align-items: center;
    flex: 1;
}

.coordinate-label {
    width: 20px;
    font-size: 0.9rem;
    color: #666;
}

.coordinate-input-group input {
    flex: 1;
}

/* Style for the button group */
.coordinate-button-group {
    display: flex;
    gap: 4px;
}

/* Base style for coordinate buttons */
.coordinate-button {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.coordinate-button:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.coordinate-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.coordinate-pick-button::before {
    content: "\2316";  /* Crosshair symbol ⌖ */
    font-size: 16px;
}

.coordinate-reset-button::before {
    content: "\21BA";  /* Counterclockwise arrow symbol ↺ */
    font-size: 16px;
}

button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--primary-dark);
}

button.share-btn {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--primary-dark);
    border: 1px solid var(--primary-color);
    font-weight: 500;
}

button.share-btn:hover {
    background-color: rgba(52, 152, 219, 0.2);
}

.canvas-container {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    position: fixed;
    left: 340px;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: calc(100vw - 380px);
    min-height: 600px;
    max-height: 90vh;
}

canvas {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 800px;
    height: 600px;
    max-width: 100%;
    max-height: 80vh;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.close-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
}

.modal-content textarea {
    width: 100%;
    height: 250px;
    margin: 10px 0;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    resize: vertical;
}

#import-error {
    color: #e74c3c;
    margin: 10px 0;
    font-size: 0.9rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

.collapsible-section .collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-section .collapse-icon {
    transition: transform 0.3s;
    font-size: 0.8rem;
}

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

.collapsible-section .collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 1000px;
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
}

.collapsible-header:hover {
    color: var(--primary-color);
}

.notification {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--radius);
    background-color: var(--accent-color);
    color: white;
    box-shadow: var(--shadow);
    z-index: 2000;
    font-weight: 500;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.notification.show {
    display: block;
    opacity: 1;
}

.notification.success {
    background-color: #2ecc71;
}

.notification.error {
    background-color: #e74c3c;
}

.notification.info {
    background-color: var(--primary-color);
}

.centroid-control {
    margin-bottom: 15px;
}

.centroid-status {
    background-color: var(--bg-color);
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: #666;
    border-left: 3px solid transparent;
}

#centroid-status-instructions {
    display: none;
}

.centroid-status.instructions {
    font-style: italic;
}

.centroid-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

button.primary-btn {
    background-color: var(--primary-color);
}

button.primary-btn:hover {
    background-color: var(--primary-dark);
}

button.outline-btn {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

button.outline-btn:hover:not(:disabled) {
    background-color: rgba(52, 152, 219, 0.1);
}

button.outline-btn:disabled {
    border-color: #ccc;
    color: #999;
    cursor: not-allowed;
}

/* Add styling for button when disabled */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.grid-generator {
    display: flex;
    align-items: center;
}

.grid-generator input {
    width: 60px;
    text-align: center;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 5px 0 10px 0;
}

.sidebar ul li {
    margin-bottom: 8px;
    padding-left: 5px;
    position: relative;
}

.sidebar ul li:before {
    content: "•";
    color: var(--primary-color);
    display: inline-block;
    width: 12px;
    margin-right: 4px;
}

.sidebar ul li a {
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-block;
    padding: 2px 0;
}

.sidebar ul li a:hover {
    color: var(--primary-color);
}

.sidebar ul li a:active {
    color: var(--accent-color);
}

.reset-button-container {
    margin-top: 15px;
    display: none;
}

#shader-reset-button {
    font-size: 0.65rem;
    padding: 6px 12px;
}

/* Toggle Switch */
.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  
  .switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
  }
  
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 20px;
    transition: 0.3s;
  }
  
  .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
  }
  
  input:checked + .slider {
    background-color: var(--primary-color);
  }
  
  input:checked + .slider:before {
    transform: translateX(20px);
  }