.matrix-inverse-calculator {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9f9f9;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 20px auto;
    color: #333;
    border: 1px solid #e0e0e0;
}



.input-section, .result-section {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    background-color: #ffffff;
}

.field-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.field-group label {
    flex-shrink: 0;
    font-weight: bold;
    color: #555;
}

.field-group input[type="number"] {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

button {
    background-color: #4CAF50; /* A pleasant green */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #45a049;
}

button:active {
    background-color: #3e8e41;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

#clear-matrix {
    background-color: #f44336; /* Red for clear */
}

#clear-matrix:hover {
    background-color: #da190b;
}

.matrix-input-container {
    display: grid;
    gap: 8px;
    margin-top: 15px;
    border: 1px dashed #e0e0e0;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto; /* For mobile responsiveness */
}

.matrix-input-row {
    display: contents; /* Allows grid to control direct children */
}

.matrix-input-container input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    font-size: 0.95rem;
    box-sizing: border-box; /* Include padding in width */
}

.matrix-output {
    display: grid;
    gap: 8px;
    margin-top: 15px;
    border: 1px dashed #e0e0e0;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}

.matrix-output-row {
    display: contents;
}

.matrix-output-cell {
    padding: 8px;
    border: 1px solid #e8e8e8;
    background-color: #f0f0f0;
    border-radius: 4px;
    text-align: center;
    font-size: 0.95rem;
    min-width: 60px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap; /* Prevent numbers from wrapping */
}

.result-value {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background-color: #e6ffe6;
    border: 1px solid #a8e6a8;
    border-radius: 5px;
    color: #28a745;
}

.error-message {
    color: #d32f2f;
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-top: 15px;
    font-weight: bold;
}

.section-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    background-color: transparent;
    color: #555;
    padding: 12px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-radius: 0; /* Remove border-radius for tab effect */
}

.tab-button:hover {
    color: #4CAF50;
    border-bottom: 2px solid #a8e6a8;
}

.tab-button.active {
    color: #4CAF50;
    font-weight: bold;
    border-bottom: 2px solid #4CAF50;
    background-color: #e6ffe6;
}

.tab-content {
    display: none;
    padding: 15px 0;
}

.tab-content.active {
    display: block;
}

#calculation-steps {
    list-style-type: decimal;
    padding-left: 25px;
    margin-top: 15px;
    color: #444;
}

#calculation-steps li {
    margin-bottom: 8px;
    line-height: 1.5;
    background-color: #fcfcfc;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #eee;
}

#calculation-steps strong {
    color: #2c3e50;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .matrix-inverse-calculator {
        padding: 15px;
        margin: 10px;
    }

    .field-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-group input[type="number"] {
        width: 100%;
        margin-top: 5px;
    }

    .actions {
        flex-direction: column;
        gap: 10px;
    }

    button {
        width: 100%;
    }

    .matrix-input-container input,
    .matrix-output-cell {
        font-size: 0.85rem;
        padding: 6px;
        min-width: 50px;
    }

    .tab-button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}