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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.toolbar {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.toolbar-separator {
    width: 1px;
    height: 25px;
    background-color: #ccc;
    margin: 0 5px;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
    transform: translateY(-1px);
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.sidebar h3 {
    margin-bottom: 1rem;
    color: #555;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

.tool-panel, .axes-panel, .object-list-panel, .properties-panel {
    margin-bottom: 2rem;
}

.tool-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.tool-btn {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.tool-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.tool-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.tool-btn .icon {
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    background: white;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.form-group:has(input[type="number"]) {
    display: flex;
    flex-direction: column;
}

.form-group:has(input[type="number"]) input {
    margin-bottom: 0.25rem;
}

.form-group:has(input[type="number"]) input:last-child {
    margin-bottom: 0;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: white;
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

#plot-canvas {
    display: block;
    cursor: crosshair;
    background: white;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.coordinates-display {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

.properties-panel .no-selection,
.object-list-panel .no-objects {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.object-list {
    max-height: 200px;
    overflow-y: auto;
}

.object-item {
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f9f9f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.object-item:hover {
    background: #e8f0fe;
    border-color: #667eea;
}

.object-item.selected {
    background: #667eea;
    color: white;
    border-color: #5a6fd8;
}

.object-item-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.object-item-type {
    font-weight: 600;
    font-size: 0.9rem;
}

.object-item-details {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.1rem;
}

.object-item.selected .object-item-details {
    color: #ddd;
}

.object-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 0.5rem;
}

/* Collapsible panel styles */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h3 {
    margin: 0;
}

.collapse-toggle {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 0.8rem;
    color: #666;
}

.collapse-toggle:hover {
    background-color: #f0f0f0;
}

.collapse-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

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

.collapsible-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.property-group {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.property-group h4 {
    margin-bottom: 0.5rem;
    color: #667eea;
    font-size: 0.9rem;
}

.property-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.property-row:last-child {
    margin-bottom: 0;
}

.property-row label {
    font-size: 0.8rem;
    color: #666;
}

.property-row input {
    width: 60px;
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.8rem;
}

.color-input {
    width: 40px !important;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.delete-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.delete-btn:hover {
    background: #da190b;
}

/* Function panel styles */
.function-panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.range-inputs input {
    flex: 1;
}

.range-inputs span {
    font-weight: 500;
    color: #666;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
    .tool-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}
