/* Global Layout Override */
.container {
    max-width: 100% !important;
    margin: 0 auto !important;
    width: 100% !important;
    padding: 0 20px !important;
    box-sizing: border-box;
}

.content {
    padding: 10px 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* 3-Column Layout */
.plot-layout {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
    height: calc(100vh - 80px); /* Fit screen height */
}

/* Left Sidebar: Control Section */
.control-section {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    width: 280px; /* Compact width */
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.control-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

/* Input Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 5px;
    display: block;
    font-weight: 600;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 0.8rem;
    line-height: 1.4;
}

.func-input, 
input[type="text"], 
input[type="number"],
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Consolas', 'Monaco', monospace;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

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

/* Button Styles */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.25);
    transition: transform 0.1s, box-shadow 0.1s;
    width: 100%;
    font-size: 0.95rem;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: #f8f9fa;
    color: #555;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.add-function-btn {
    width: 100%;
    padding: 8px;
    background: #f0f4ff;
    color: #667eea;
    border: 1px dashed #667eea;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-bottom: 15px;
}

.add-function-btn:hover {
    background: #e0e8ff;
}

/* Center: Plot Area */
.plot-wrapper {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    position: relative;
    flex-grow: 1;
    min-width: 0; /* Prevent flex overflow */
    height: 100%;
    display: flex;
    flex-direction: column;
}

#plot {
    width: 100% !important;
    height: 100% !important;
    background: #fafafa;
}

/* Right Sidebar: Info Section */
.info-sidebar {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    width: 300px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-panel {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #eee;
}

.info-panel h4 {
    margin: 0 0 10px 0;
    color: #444;
    font-size: 0.95rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Domain Controls Grid */
.domain-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
}

.domain-controls .form-group {
    margin-bottom: 0;
}

/* Function Item Styles */
.function-item {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #ccc;
    transition: transform 0.2s;
    margin-bottom: 10px;
}

.function-item:hover {
    background: #f0f0f0;
}

.function-item h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-function-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0;
}

.remove-function-btn:hover {
    color: #ff4d4f;
}

/* Intersection List Styles */
.intersection-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
}

.intersection-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}

.intersection-item:last-child {
    border-bottom: none;
}

.function-name {
    font-weight: bold;
    color: #667eea;
}

.coordinates {
    font-family: monospace;
    background: #e9ecef;
    padding: 2px 4px;
    border-radius: 3px;
    color: #333;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
    cursor: pointer;
}

.checkbox-group input {
    width: auto;
}

.checkbox-group label {
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
    margin-bottom: 0;
}

/* Mobile Responsiveness */
@media (max-width: 1200px) {
    .plot-layout {
        flex-wrap: wrap;
        height: auto;
    }
    
    .control-section {
        width: 100%;
        height: auto;
        max-height: 300px;
    }

    .plot-wrapper {
        height: 500px;
        width: 100%;
    }

    .info-sidebar {
        width: 100%;
        height: auto;
        max-height: 400px;
    }
}
