/*
    Project: Gauss-Calculator
    Authors: Ali Al-Kubaisi and Simon Amberg
    Date: 2024-12-20
    License: MIT
    Description: CSS file for styling the Gauss-Calculator user interface.
*/

body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

:root {
    --primary-color: #4CAF50;
    --primary-dark-color: #45a049;
    --background-light: #f9f9f9;
    --background-dark: #e9e9e9;
    --on-light: #444;
}

.main-page {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.page-content {
    flex: 1;
}

/* Styling for Inputs */
.input-field {
    width: calc(100% - 16px);
    padding: 10px;
    margin: 10px 0;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="number"], input[type="text"] {
    width: 300px;
}

label {
    font-weight: bold;
    display: block;
    margin: 8px 0 4px;
}

select {
    margin: 8px 0;
}

.main-menu {
    background-color: var(--primary-color);
    padding: 0px 0;
}

/* Buttons */
.operation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 20px;
}

.operation-buttons button {
    flex: 0 0 auto;
    box-sizing: border-box;
}
.operation-buttons button .icon{
    vertical-align: text-bottom;
}

.calculator-button {
    padding: 10px 20px;
    font-size: 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    margin-right: 8px;
    cursor: pointer;
    border: 1px solid var(--primary-color);
    transition: background-color 0.3s;
}

.mainoperation-button {
    padding: 5px 16px;
    font-size: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    margin-right: 8px;
    cursor: pointer;
    border: 1px solid var(--primary-color);
    transition: background-color 0.3s;
}

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

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

/* Results and Steps */
.result-value {
    font-size: 1.25rem;
    color: #333;
    font-weight: bold;
}

.steps-display {
    background-color: var(--background-light);
    padding: 16px;
    border-radius: 4px;
    margin-top: 8px;
    white-space: pre-wrap;
    font-size: 1rem;
    color: var(--on-light);
    border: 1px solid #ccc;
}

.page-footer {
//    background-color: var(--primary-color);
//    color: white;
    text-align: center;
}

.fraction-input {
    display: grid;
    grid-template-columns: min-content max-content;
    grid-auto-rows: min-content;
}

.fraction-input label, .fraction-input input {
    margin: 0;
    position: relative;

}

.fraction-input > label {
    align-content: center;
    font-weight: normal;
    margin-right: 8px;
    font-size: 1rem;
}

.fraction-input > .border-bottom {
    border-bottom: 1px solid gray;
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.input-with-buttons {
    display: flex;
    align-items: center;
    gap: 3px;
}

.unary-ops {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.input-with-buttons .polynomial-input + .unary-ops {
    align-self: end
}

.input-with-buttons .polynomial-input + .unary-ops button{
    padding-block: 10px 11px;
    line-height: 1rem;
    border: none;
}

.polynomial-input {
    display: grid;
    grid-template-rows: min-content min-content;
    grid-auto-columns: max-content;
    overflow-x: auto;
}
.polynomial-input > .polynomial, .polynomial-input > .flex-button {
    grid-row: 2/3;
}
.polynomial-input .input-field {
    width: auto;
    padding: unset;
    border: none;
    margin: 0;
}
.polynomial-input > .polynomial {
    position: relative;
    padding-block: 10px 11px;
    margin-right: 1px;
}

.polynomial-input > .polynomial > input {
    position: absolute;
    left: 0;
    width: 100%;
    border: 1px solid #ccc;
    padding-block: 8px;
    bottom: 0;
    line-height: 1;
    text-align: center;
}

/* hide increment arrows Chrome, Safari, Edge, Opera */
.polynomial-input > .polynomial > input::-webkit-outer-spin-button,
.polynomial-input > .polynomial > input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}



/* hide increment arrows Firefox */
.polynomial-input > .polynomial > input[type=number] {
    -moz-appearance: textfield;
}

.polynomial-input > .polynomial > .ghost {
    opacity: 0;
    padding-inline: 1rem;
    line-height: 1;
}

.polynomial-input > .polynomial-label {
    font-size: 0.9rem;
    text-align: center;
}

.polynomial-input > .polynomial-label .sup {
    position: relative;
    bottom: 1ex;
    font-size: 0.75rem;
}

.polynomial-input > .polynomial-label + .polynomial > input {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border: 1px solid #ccc;
}

.polynomial-input > .polynomial-label + .polynomial > .ghost {
    padding-inline-start: calc(1rem + 4px);
}

.polynomial-input .flex-button {
    display: flex;
}

.polynomial-input button {
    padding: 0 8px;
    flex: 1;
    border-radius: 5px;
    border: 1px solid var(--primary-color);
}

.field-selection {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}
.field-selection > div:not(:last-child) {
    margin-right: 16px;
}

section {
    border: 1px solid gray;
    border-radius: 4px;
    margin-block: 16px;
    padding-inline: 16px;
    padding-block: 8px;
}

/* polynomial result representation*/
.result-value > .polynomial-input, .polynomial-input[disabled=true] {
    display: grid;
    grid-template-rows: min-content min-content;
    grid-auto-columns: max-content;
    gap: 10px;
}

.result-value > .polynomial-input {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin-top: 16px;
}

.result-value > .polynomial-input > .polynomial ,  .polynomial-input[disabled=true] > .polynomial {
    grid-row: 2;
    padding: 5px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.result-value > .polynomial-input > .polynomial-label  .polynomial-input[disabled=true] > .polynomial-label {
    grid-row: 1;
    font-weight: bold;
    padding: 5px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.definition-wrapper
{
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.card, .field-wrapper, .extension-wrapper {
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: var(--background-light);
}

.field-wrapper, .extension-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.field-selection, .extension-definition {
    display: grid;
    gap: 15px;
}

.field-selection label, .extension-wrapper label {
    font-weight: bold;
    margin-bottom: 5px;
}

.select-field {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

.min-polynomial {
    display: grid;
    gap: 10px;
}

.min-polynomial-custom-input {
    margin-block: 10px;
    display: grid;
}

.validate-button {
    margin-top: 10px;
}

.take-over-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.error-message {
    color: #ff4d4d; /* Red for error */
    background-color: #ffe6e6; /* Light red background */
    border: 1px solid #ff9999; /* Subtle border */
    padding: 8px;
    border-radius: 4px; /* Rounded corners */
    font-size: 14px; /* Adjust font size */
    margin-top: 8px; /* Space from input */
    text-align: left; /* Align text to the left */
    max-width: 400px; /* Limit the width */
    word-wrap: break-word; /* Handle long messages */
}


.history {
    overflow-y: auto;
    max-height: 40vh;
}

.history-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: start;
    border-bottom: 1px solid lightgray;
    padding-block: 10px;
    margin-bottom: 5px;
}
.history-row .operation {
    margin-inline: 10px;
}
.history-row:last-child {
    margin-bottom: 0;
}
.history-entry {
    border-bottom: 1px solid gray;
}
.history-entry:last-child {
    border-bottom: 0;
}
.history-row .label {
    margin-right: 10px;
}
.history-row .take-over-buttons {
    display: flex;
    margin: 0 0 0 auto;
}
.history-row .take-over-buttons button {
    padding: 5px;
}
.flex-row {
    display: flex;
    flex-direction: row;
}
.justify-end {
    justify-content: end;
}
.ml-1 {
    margin-left: 5px;
}
.ml-2 {
    margin-left: 10px;
}
.ml-auto {
    margin-left: auto;
}
.m-0 {
    margin: 0;
}
.clickable {
    cursor: pointer;
}
.fw-normal {
    font-weight: normal;
}

/* Custom Switch */
/* The switch - the box around the slider */
:root {
    --slider-ball-size: 1rem;
    --slider-gap: 4px;
}
.switch {
    position: relative;
    display: inline-block;
    width: calc(var(--slider-ball-size) * 2 + 2 * var(--slider-gap));
    height: calc(var(--slider-ball-size) + 2 * var(--slider-gap));
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: var(--slider-ball-size);
    width: var(--slider-ball-size);
    left: var(--slider-gap);
    bottom: var(--slider-gap);
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    -webkit-transform: translateX(var(--slider-ball-size));
    -ms-transform: translateX(var(--slider-ball-size));
    transform: translateX(var(--slider-ball-size));
}

/* Rounded sliders */
.slider.round {
    border-radius: calc(var(--slider-ball-size) + 2 * var(--slider-gap));
}

.slider.round:before {
    border-radius: 50%;
}
