/* --- 1. Animated Gradient Background --- */
@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: 'Arial', sans-serif;
    text-align: center;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0px 0;
    background: linear-gradient(-45deg, #1a0b3e, #4a1c6f, #8a3a8b, #2c0e5a);
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
    overflow: hidden; /* Prevent page from scrolling */
}

/* --- 2. Glassmorphism Converter Box --- */
#converter {
    position: relative; /* Needed for positioning the refresh button */
    width: 90%;
    max-width: 420px;
    padding: 30px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

img {
    width: 120px;
    height: auto;
    margin: 0 auto 20px auto;
}

/* Form Elements Styling */
label {
    display: block;
    text-align: left;
    margin: 0 0 8px 5px;
    color: #f0f0f0;
    font-weight: bold;
    font-size: 14px;
}


/* --- 3. (FIX) Hiding the number input arrows with standard property --- */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield; /* For older Firefox */
  appearance: none; /* Standard property for modern browsers */
}

#amount, .selected-option {
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

#amount:focus {
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
    border-color: #ffffff;
}

#amount {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.15);
    outline: none;
    box-sizing: border-box;
    color: #ffffff;
}

#amount::placeholder {
    color: #cccccc;
}

.currency-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 25px;
}

.currency-box {
    width: 100%;
}

/* Custom Searchable Dropdown Styles */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    font-size: 14px;
}

.selected-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
}

.selected-option:focus,
.custom-select-wrapper.open .selected-option {
    border-color: #ffffff;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
}

.selected-text {
    color: #ffffff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fa-angle-down {
    color: #ffffff;
}

.options-container {
    display: none;
    position: absolute;
    top: 105%;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    z-index: 10;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    box-sizing: border-box;
    padding: 6px 6px;
}

.custom-select-wrapper.open .options-container {
    display: block;
}

.search-box {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 6px;
    box-sizing: border-box;
}

.search-box input {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.search-box input::placeholder {
     color: rgba(0,0,0,0.6);
    font-weight: 500;
}

.search-box input:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.06), 0 6px 18px rgba(0,0,0,0.25);
    background-color: rgba(255,255,255,0.08);
    color: #ffffff;
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #f0f0f0;
}

.options-list li {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.08s ease;
    text-align: left;
    color: #fff;
    border-radius: 6px;
    margin: 2px 0;
    user-select: none;
}

.options-list li:hover,
.options-list li.highlighted {
    background-color: rgba(255, 255, 255, 0.10);
    transform: translateY(-1px);
}

.options-list li.hidden {
    display: none;
}

button {
    background-color: #8a6de9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 18px;
    width: 100%;
    text-transform: uppercase;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #7050c2;
    transform: scale(1.05);
    box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: scale(0.98);
}

#refreshButton {
    position: absolute;
    top: 14px;
    left: 15px;
    width: 80px;
    height: 28px;
    border-radius: 8px;
    background-color: #8a6de9;
    color: #fff;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.2s ease, box-shadow 0.3s ease;
    z-index: 20;
    text-transform: none;
}

#refreshButton:hover {
    background-color: #7050c2;
    transform: scale(1.1);
    box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.3);
}

#refreshButton:active {
    transform: scale(0.95);
}

#result {
    font-size: 20px;
    font-weight: 700;
    margin-top: 20px;
    min-height: 22px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.25);
    transition: color 0.3s ease;
}

#result.placeholder {
    color: #ffffff !important;
}

#result.converted {
    color: #00ff9b !important;
}

#result.error {
    color: #ff8787 !important; /* Bright red for errors */
}

/* Scrollbar Styling */
.options-container::-webkit-scrollbar {
    width: 9px;
}
.options-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
}
.options-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0.12));
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
}

/* --- Responsive Design Final Fix --- */
@media (max-width: 480px) {
    body {
        padding: 0px 20px; 
        align-items: center;
        overflow-y: hidden; /* This prevents scrolling on mobile */
    }

    #converter {
        padding: 20px;
        width: 100%;
        margin-top: -93px; 
    }

    img {
        width: 100px;
    }

    .currency-container {
        flex-direction: column;
        gap: 20px;
    }

    #refreshButton {
        top: 12px;
        left: 12px;
        width: 75px;
        height: 26px;
        font-size: 13px;
    }
    
    #result,
    #result.converted,
    #result.error {
        font-size: 18px;
    }

    button {
        font-size: 16px;
    }
}

