/* style.css */

/* General Body and Container adjustments */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    margin: 20px 0;
    padding: 0 10px;
    box-sizing: border-box;
}

.content {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

.container {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
}

.calculator-form {
    margin-bottom: 20px;
}

.variable-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1px;
    flex-wrap: wrap;
    padding: 1px 5px;
    border-radius: 4px;
}

.variable-row:nth-child(odd) {
    background-color: #ffffff;
}
.variable-row:nth-child(even) {
    background-color: #f9f9f9;
}

.variable-input {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 2;
    min-width: 250px;
}

.variable-input label {
    flex-shrink: 0;
    width: 120px;
    text-align: right;
    font-weight: bold;
    color: #555;
}

.variable-input input[type="number"],
.variable-input select {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 80px;
    box-sizing: border-box;
    font-size: 1rem;
    line-height: 1.4;
}

.variable-input input[type="number"]:focus,
.variable-input select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.variable-output {
    flex: 1;
    text-align: right;
    padding-left: 20px;
    font-size: 1.1em;
    color: #0056b3;
    font-weight: bold;
    min-width: 100px;
}

.variable-input.known label,
.variable-input.known input,
.variable-input.known select {
    color: #28a745;
    border-color: #28a745;
}

.variable-input.invalid label,
.variable-input.invalid input,
.variable-input.invalid select {
    color: #dc3545;
    border-color: #dc3545;
}

.variable-input.invalid-relation label,
.variable-input.invalid-relation input,
.variable-input.invalid-relation select {
    color: #ffc107;
    border-color: #ffc107;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 0;
    border-top: 1px solid #eee;
    background: #f0f8ff;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.controls button {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.controls button:hover {
    background-color: #0056b3;
}

/* Checkbox and label alignment: label left, checkbox right */
.controls .checkbox-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.controls .checkbox-group label {
    order: 1;
    margin-right: auto;
}

.controls .checkbox-group input[type="checkbox"] {
    order: 2;
    margin-left: auto;
    transform: scale(1.2);
}

.controls input[type="number"] {
    width: 80px;
}

.unit-switch-btn {
    background-color: #6c757d;
    color: white;
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
    border: 1px solid #5a6268;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.unit-switch-btn:hover {
    background-color: #545b62;
    transform: translateY(-1px);
}

.unit-switch-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.earth-symbol-btn {
    font-size: 1em;
}

.jupiter-symbol-btn {
    font-size: 1.2em;
}

.si-symbol-btn {
    font-size: 0.7em;
    font-weight: bold;
}

.big-si-symbol-btn {
    font-size: 0.6em;
    font-weight: bold;
}

.legend-container {
    background-color: #f0f8ff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    margin-top: 20px;
}

.legend-container h3 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.legend-item {
    font-size: 0.95em;
    color: #666;
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item.legend-variables {
    gap: 8px 15px;
}

.legend-item-part {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}

.legend-symbol {
    font-weight: bold;
    color: #0056b3;
    flex-shrink: 0;
}

.legend-list hr {
    width: 100%;
    border: none;
    border-top: 1px solid #eee;
    margin: 10px 0;
    box-sizing: border-box;
}

.legend-container {
    position: relative;
}

.legend-info-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #007bff;
    color: white;
    border-radius: 50%;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    line-height: 1;
}

.legend-info-btn:hover {
    background: #0056b3;
}

@media (max-width: 768px) {
    .variable-row {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        margin-bottom: 10px;
        gap: 5px;
        flex: 1 1 100%;
    }

    .variable-input {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        min-width: 100%;
        width: 100%;
    }

    .variable-input label {
        width: 100%;
        margin-right: 0;
        text-align: left;
    }

    .variable-input input[type="number"],
    .variable-input select {
        width: 100%;
    }

    .variable-output {
        text-align: left;
        width: 100%;
        padding-left: 0;
        margin-top: 5px;
        flex: 1 1 100%;
        min-height: 0;
    }

    .controls {
        padding: 10px;
        gap: 8px;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 5px;
    }

    .controls button,
    .controls input[type="number"],
    .controls label,
    .controls input[type="checkbox"] {
        width: 100%;
        text-align: left;
    }

    .unit-switch-btn {
        width: 40px;
        height: 40px;
        margin-left: 0;
        margin-top: 5px;
        align-self: flex-start;
    }

    .legend-list {
        gap: 8px;
    }
}
