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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-link {
    text-decoration: none;
    color: white;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 2rem;
}

.sidebar {
    width: 280px;
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.tool-category h3 {
    margin-bottom: 1rem;
    color: #667eea;
    font-size: 1.2rem;
}

.tool-list {
    list-style: none;
}

.tool-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
}

.tool-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.tool-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tool-icon {
    font-size: 1.5rem;
    margin-right: 0.8rem;
    width: 30px;
    text-align: center;
}

.tool-name {
    font-weight: 500;
}

.tool-panel {
    flex: 1;
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tool-section {
    display: none;
}

.tool-section.active {
    display: block;
}

.tool-section h2 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.tool-description {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

input[type="text"],
input[type="number"],
textarea,
select {
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

input[type="text"],
input[type="number"],
select {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

textarea {
    width: 100%;
    resize: vertical;
    font-family: inherit;
}

label {
    display: inline-block;
    margin-bottom: 0.3rem;
    color: #555;
    font-weight: 500;
}

.function-inputs {
    margin-bottom: 1rem;
}

.function-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
}

.function-label {
    width: 60px;
    font-weight: bold;
}

.function-input {
    flex: 1;
    margin: 0 0.5rem;
}

.color-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.range-inputs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.range-input {
    display: flex;
    flex-direction: column;
}

.range-input input {
    width: 100%;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.graphing-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.canvas-container {
    position: relative;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

#graphCanvas {
    display: block;
    width: 100%;
    height: 500px;
}

.coordinates {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.85rem;
    color: #555;
}

.equation-type-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.eq-type-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eq-type-btn:hover {
    background: #f0f0f0;
}

.eq-type-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.equation-input-group {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.equation-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.equation-input-group input {
    width: 120px;
    margin-right: 0.5rem;
}

.system-row {
    margin-bottom: 0.5rem;
}

.solve-btn {
    margin-top: 1rem;
}

.equation-result {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    min-height: 50px;
}

.calculus-tabs,
.matrix-tabs,
.algebra-tabs,
.geometry-tabs,
.converter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.calc-tab-btn,
.matrix-tab-btn,
.algebra-tab-btn,
.geometry-tab-btn,
.converter-tab-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calc-tab-btn:hover,
.matrix-tab-btn:hover,
.algebra-tab-btn:hover,
.geometry-tab-btn:hover,
.converter-tab-btn:hover {
    background: #f0f0f0;
}

.calc-tab-btn.active,
.matrix-tab-btn.active,
.algebra-tab-btn.active,
.geometry-tab-btn.active,
.converter-tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.calc-content,
.matrix-content,
.algebra-content,
.geometry-content,
.converter-content {
    display: none;
}

.calc-content.active,
.matrix-content.active,
.algebra-content.active,
.geometry-content.active,
.converter-content.active {
    display: block;
}

.calc-content,
.algebra-content,
.geometry-content {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.calc-content label,
.algebra-content label,
.geometry-content label {
    display: block;
    margin-bottom: 0.5rem;
}

.calc-content input,
.algebra-content input,
.geometry-content input {
    width: 100%;
    margin-bottom: 1rem;
}

.calc-result,
.geo-result {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    min-height: 50px;
}

.integral-type,
.limit-direction {
    margin-bottom: 1rem;
}

.integral-type label,
.limit-direction label {
    margin-right: 1rem;
    cursor: pointer;
}

.integral-limits {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.matrix-inputs {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.matrix-input-container {
    flex: 1;
    min-width: 200px;
}

.matrix-input-container h4 {
    margin-bottom: 0.5rem;
    color: #667eea;
}

.matrix-grid {
    display: grid;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.matrix-grid input {
    width: 60px;
    text-align: center;
    margin: 0;
}

.matrix-operations {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.matrix-op-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    border: 2px solid #667eea;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #667eea;
}

.matrix-op-btn:hover {
    background: #667eea;
    color: white;
}

.matrix-result {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    min-height: 50px;
}

.single-matrix-input {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.single-matrix-input h4 {
    margin-bottom: 0.5rem;
    color: #667eea;
}

.data-input-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.data-input-section textarea {
    width: 100%;
    margin-bottom: 1rem;
}

.stats-results {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.converter-content {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.converter-content input {
    width: 200px;
    margin-bottom: 1rem;
}

.converter-content select {
    width: 150px;
    margin-bottom: 1rem;
}

.converter-arrow {
    font-size: 1.5rem;
    margin: 0 1rem;
    color: #667eea;
}

.converter-result {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    min-height: 50px;
}

.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 2rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .tool-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .range-inputs {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .matrix-inputs {
        flex-direction: column;
    }
    
    .matrix-operations {
        flex-direction: row;
    }
}

.result-title {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.result-content {
    color: #333;
    line-height: 1.6;
}

.physics-tools,
.chemistry-tools {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.physics-tabs,
.chemistry-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.physics-tab-btn,
.chemistry-tab-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.physics-tab-btn:hover,
.chemistry-tab-btn:hover {
    background: #667eea;
    color: white;
}

.physics-tab-btn.active,
.chemistry-tab-btn.active {
    background: #667eea;
    color: white;
}

.physics-content,
.chemistry-content {
    display: none;
}

.physics-content.active,
.chemistry-content.active {
    display: block;
}

.physics-input-group,
.chemistry-input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.physics-input-group label,
.chemistry-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.physics-input-group input,
.chemistry-input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.physics-input-group input:focus,
.chemistry-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.physics-calc-btn,
.chemistry-calc-btn {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.physics-calc-btn:hover,
.chemistry-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.physics-calc-btn:active,
.chemistry-calc-btn:active {
    transform: translateY(0);
}

.error {
    color: #e74c3c;
    font-weight: bold;
}

.success {
    color: #27ae60;
    font-weight: bold;
}

.option-label {
    margin-left: 1rem;
    display: inline-block;
    white-space: nowrap;
}

.graph-options {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.preset-functions {
    margin: 1rem 0;
    display: flex;
    align-items: center;
}

#preset-func {
    margin: 0 0.5rem;
    flex-grow: 0;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.function-values {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 5px;
}

#values-table {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.value-cell {
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #ddd;
}

.preset-equations {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

#preset-equation {
    margin: 0 0.5rem;
    flex-grow: 0;
    min-width: 200px;
}

.equation-details {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    min-height: 50px;
}

.equation-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.equation-input-group label {
    margin-bottom: 0;
}

.equation-input-group input {
    margin-bottom: 0;
    width: 80px;
}

.system-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.system-row input {
    width: 80px;
    margin-bottom: 0;
}

.visualize-btn {
    margin-left: 0.5rem;
}

.calculus-preset {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

#calculus-preset {
    margin: 0 0.5rem;
    flex-grow: 0;
    min-width: 150px;
}

.preset-matrices {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

#matrix-preset {
    margin: 0 0.5rem;
    flex-grow: 0;
    min-width: 150px;
}

.preset-data {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

#stats-preset {
    margin: 0 0.5rem;
    flex-grow: 0;
    min-width: 150px;
}

.stats-visualization {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

#statsCanvas {
    max-width: 100%;
    height: 300px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.advanced-math-tools,
.exam-math-tools {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.advanced-math-tabs,
.exam-math-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.advanced-math-tab-btn,
.exam-math-tab-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.advanced-math-tab-btn:hover,
.exam-math-tab-btn:hover {
    background: #667eea;
    color: white;
}

.advanced-math-tab-btn.active,
.exam-math-tab-btn.active {
    background: #667eea;
    color: white;
}

.advanced-math-content,
.exam-math-content {
    display: none;
}

.advanced-math-content.active,
.exam-math-content.active {
    display: block;
}

.vector-inputs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.vector-inputs input {
    flex: 1;
    min-width: 150px;
}

.point-inputs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.point-inputs input {
    flex: 1;
    min-width: 80px;
}

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

.complex-inputs input {
    flex: 1;
    min-width: 100px;
}

.advanced-math-panel,
.exam-math-panel {
    margin-top: 1rem;
}

.experiment-tools {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.experiment-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.experiment-tab-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.experiment-tab-btn:hover {
    background: #667eea;
    color: white;
}

.experiment-tab-btn.active {
    background: #667eea;
    color: white;
}

.experiment-content {
    display: none;
}

.experiment-content.active {
    display: block;
}

.experiment-canvas-container {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.experiment-canvas-container canvas {
    display: block;
    width: 100%;
    height: auto;
}

.experiment-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #dee2e6;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.control-group span {
    font-size: 0.85rem;
    color: #6c757d;
    text-align: center;
}

.experiment-results {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 8px;
    border: 1px solid #667eea;
}

.experiment-results h3 {
    margin-bottom: 1rem;
    color: #667eea;
    font-size: 1.1rem;
}

.data-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.data-value {
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 600;
}