/* Light Mode Variables */
:root {
    --card-bg: rgba(255, 255, 255, 0.3);
    --card-border: 1px solid rgba(255, 255, 255, 0.5);
    --card-shadow: 0 0 10px rgba(50, 50, 50, 0.5), inset 0 0 10px rgba(255,255,255, 0.5);
    --text-color: rgba(0, 0, 0, 0.8);
    --text-shadow: 0 0 6px rgba(255,255,255, 0.6);
    --input-bg: rgba(255,255,255, 0.4);
    --input-text-color: #323232;
    --input-text-shadow: 0 0 10px rgba(255,255,255, 0.6);
    --placeholder-color: rgba(0, 0, 0, 0.6);
    --input-focus-bg: rgba(255, 255, 255, 0.6);
    --input-focus-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(0, 0, 0, 0.2);
    --arrow-color: rgba(0, 0, 0, 0.7);
    --option-bg: rgba(255, 255, 255, 0.9);
    --option-text-color: #333333;
    --option-border: 1px solid rgba(0, 0, 0, 0.1);
    --option-hover-bg: rgba(0, 0, 0, 0.1);
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: rgba(0, 0, 0, 0.2);
        --card-border: 1px solid rgba(255, 255, 255, 0.3);
        --card-shadow: 0 0 10px rgba(50, 50, 50, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.5);
        --text-color: rgba(255, 255, 255, 0.9);
        --text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
        --input-bg: rgba(255, 255, 255, 0.3);
        --input-text-color: #ffffff;
        --input-text-shadow: 0 0 10px rgba(0,0,0, 0.6);
        --placeholder-color: rgba(255, 255, 255, 0.7);
        --input-focus-bg: rgba(255, 255, 255, 0.25);
        --input-focus-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(255, 255, 255, 0.4);
        --arrow-color: rgba(255, 255, 255, 0.9);
        --option-bg: rgba(0, 0, 0, 0.7);
        --option-text-color: #ffffff;
        --option-border: 1px solid rgba(255, 255, 255, 0.1);
        --option-hover-bg: rgba(255, 255, 255, 0.2);
    }
}

.calculation-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    column-gap: 24px;
    row-gap: 24px;

    transition: all 0.3s ease;
}

@media screen and (min-width: 768px) {
    .calculation-wrapper {
        flex-direction: row;                
        padding: 24px;
        padding-right: 50px;
    };            
}

@media screen and (min-width: 1025px) {
    .calculation-wrapper {
        flex-direction: row;
        justify-content: center;
        padding: 24px;
        padding-right: 155px;
    };
    
}

.input-group,
.glass-container {
    background: var(--card-bg); /* Semi-transparent white */
    border-radius: 15px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3); /* Light border */
    box-shadow: var(--card-shadow); /* Subtle shadow */
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
    max-width: 400px;        
    
    /* Apply backdrop-filter to blur the distorted background */
    backdrop-filter: blur(10px) url(#glass-distortion) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);

    position: relative;
    overflow: hidden; /* Crucial to clip the distorted background to border-radius */
    z-index: 1; /* Ensure it's above the body background */ 
}

@media screen and (min-width: 768px) {
    
}

.input-group.show,
.glass-container.show {
    padding: 30px;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes liquidBackground {
    0% { background-position: 65% 100%; }
    50% { background-position: 70% 100%; }
    100% { background-position: 65% 100%; }
}

.text-center {
    text-align: center;
}

.glass-container h1, 
.glass-container h2, 
.glass-container h3, 
.glass-container h4, 
.glass-container h5,
.glass-container p {
    color: var(--text-color);
    text-shadow: var(--text-shadow);
}

.glass-input-container {
    position: relative;
    width: 100%;
}

.glass-input-container label {
    display: block;
    margin-bottom: 8px;
    text-align: left;
    color: var(--text-color);
    font-weight: bold;
    text-shadow: var(--text-shadow);
}

.glass-input-container input[type="number"]:disabled {
    background: transparent;
    border: var(--text-color);
}

.glass-input-container input[type="number"] {
    border: var(--text-color);
    background: var(--input-bg);
    -webkit-appearance: none; /* Remove default select styles */
    -moz-appearance: none;
    appearance: none;
}

.glass-input,
.glass-select {
        -webkit-appearance: none; /* Remove default select styles */
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    width: -moz-available;          /* WebKit-based browsers will ignore this. */
    width: -webkit-fill-available;  /* Mozilla-based browsers will ignore this. */
    max-width: inherit;
    padding: 12px 15px;
    border: none !important;
    background: var(--input-bg)!important;
    border-radius: 10px!important;
    color: var(--input-text-color);
    font-size: 1rem; /* Base font size */
    outline: none;
    transition: all 0.3s ease;
    text-shadow: var(--input-text-shadow);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}


.glass-input::placeholder {
    color: var(--placeholder-color);
}

.glass-input:focus,
.glass-select:focus {
    color: var(--text-color)!important;
    background: var(--input-focus-bg);
    box-shadow: var(--input-focus-shadow);
}

.glass-input:disabled,
.glass-select:disabled {
    background: transparent;
    box-shadow: none;
}

/* Style for the dropdown arrow */
.glass-select-wrapper::after {
    content: '▼'; /* Unicode down arrow */
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: var(--arrow-color);
    pointer-events: none; /* Make sure the arrow doesn't interfere with select clicks */
    font-size: 0.8rem;
}

/* Note: Styling for <option> elements is very limited and not all CSS properties
    will apply consistently across browsers. Full "liquid glass" on options
    would require a custom dropdown implementation with JavaScript.
    These styles are for the dropdown itself, not the individual options in all browsers. */
.glass-select option {
    background: var(--option-bg);
    color: var(--option-text-color);
    padding: 10px;
    border-bottom: var(--option-border);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hover effect for options (if supported by browser) */
.glass-select option:hover {
    background: var(--option-hover-bg);
}

.glowing-button {
    padding: 12px 15px;
    border: none;
    border-radius: 10px!important;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(50, 50, 50, 0.5);
    color: #f1f1f1;
    background: linear-gradient(45deg, rgb(255, 87, 51, 0.9), rgba(255, 196, 0, 0.9));
    background-size: 150% 100%;
    z-index: 1;
    box-shadow:
        0 0 8px rgb(255, 87, 51, 0.5),
        0 0 16px rgba(255, 196, 0, 0.5);
    animation: glowing-button-animation 2s ease-in-out infinite;
    cursor: pointer;
    transition: background 0.3s ease-in-out;
}

.glowing-button:disabled {
    background: linear-gradient(45deg, rgb(255, 87, 51, 0.3), rgba(255, 196, 0, 0.3));
    animation: none;
}

@keyframes glowing-button-animation {
    0% {
        background-position: 70% 100%;
        box-shadow:
            0 0 8px rgb(255, 87, 51, 0.5),
            0 0 16px rgba(255, 196, 0, 0.5);
    }
    50% {
        background-position: 100% 100%;
        box-shadow:
            -5px -5px 12px rgb(255, 87, 51, 0.5),
            5px 5px 20px rgba(255, 196, 0, 0.5);
    }
    100% {
        background-position: 70% 100%;
        box-shadow:
            0 0 8px rgb(255, 87, 51, 0.5),
            0 0 16px rgba(255, 196, 0, 0.5);
    }
}

#result-container {
    gap: 8px;            
}

#result-container p {
    font-size: x-large;            
    margin-top: 8px;
    margin-bottom: 8px;
}

@media screen and (min-width: 768px) {
    #result-container p {
        font-size: x-large;
    }
}

#result-container h2 {
    font-size: 32px;
    margin-bottom: 8px;
}

#result-container .glass-input-container {
    margin-bottom: 8px;
}

#result-container button {
    margin-top: 16px;
}
