@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600&display=swap");

body, html {
    margin: 0;
    padding: 0;
    font-family: Lora, serif;
    background-color: #000000;
    display: grid;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 1000px; 
}

.calculator {
    background-color: #444444;
    padding: 15px;
    border-radius: 15px;
    width: 100%;
    max-width: 100%; 
    margin-right: 0 auto 20px; 
    box-sizing: border-box;
}

.heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}
.heading h1 {
    font-size: 2rem;
    margin: auto;
    text-align: center;
    word-wrap: break-word;
}
.key_buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px; 
}

button {
    margin-left: 15px;
    font-size: 22px;
    width: 70px;
    height: 70px;
    border-radius: 50px;
    background-color: transparent;
    color: #000;
    border: none;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.operator-btn {
    background-color: #dfd7af;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equal {
    background-color: #36474f;
}

.history {
    background-color: #000;
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    max-width: 80%;
    width: 100%;
    display: none;
    box-sizing: border-box;
}

.history.show {
    display: block;
}

.clear-history {
    background-color: #36474f;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    border: none;
    text-align: center;
}

.clear-history:hover {
    background-color: #2c3a42;
}

.light {
    background-color: #f5f5f5;
    color: #000;
}

.light .display {
    background-color: #c7cdcd;
    color: #000;
}

.light .clear-history {
    background-color: #dfd7af;
    color: #000;
}

.light .clear-history:hover {
    background-color: #c5b78e;
}
.history-toggle{
    margin-right: 10px;
}
.theme-toggle, .history-toggle {
    background: none;
    border: none;
    font-size: 21px;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        align-items: center;
    }

    .heading h1 {
        font-size: 1.7rem;
        line-height: 1.2;  
    }

    .calculator {
        margin-right: 0;
        margin-bottom: 10px;
        max-width: 100%; 
    }

    .buttons {
        gap: 10px; 
        font-size: auto;
    }

    .history {
        max-width: 100%;
        margin-top: 20px;
        position: relative;
    }
}

/* Popup background */
.popup {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); 
    justify-content: center;
    align-items: center;
    z-index: 999; 
}

/* Popup content box */
.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 100%; 
    max-width: 200px; 
    margin: auto; 
}

body.dark-mode .popup-content {
    background-color: #444;
    color: #fff;
}

#popup-message {
    font-size: 22px; 
    font-weight: bold; 
    margin-bottom: 20px;
}

#close-popup {
    margin-top: 20px;
    padding: 20px 20px;
    background-color: #dfd7af;
    color: white;
    border-radius: 10px; 
    cursor: pointer;
    font-size: 15px; 
    font-weight: bold; 
    transition: background-color 0.3s ease, transform 0.3s ease;
}

#close-popup:hover {
    background-color: #36474f; 
    transform: scale(1.1);
}

.light #entered_amount , .light #converted_value {
    font-size: 20px;
    padding: 12px;
    border: 2px solid #000000;
    border-radius: 5px;
    width: calc(100% - 25px);
    text-align: right;
}
.dark #entered_amount , .dark #converted_value{
    font-size: 20px;
    padding: 12px;
    color: #fff;
    border: 2px solid #9BA8AB;
    border-radius: 5px;
    width: calc(100% - 25px);
    text-align: right;
}

#converted-value {
    font-size: 20px;
    font-weight: bold;
}

.reverse-button {
    display: flex;
    background-color: transparent;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 20%;
    background-size: contain;
    background-position: center;
    margin: 3px auto; 
}

.reverse-button img {
    display: none;
}

.light .reverse-button {
    background-image: url('https://raw.githubusercontent.com/SameerSinghal26/Mini_Projects/main/Currency_Exchanger/images/reverse_button_light.png');
}

.dark .reverse-button {
    background-image: url('https://raw.githubusercontent.com/SameerSinghal26/Mini_Projects/main/Currency_Exchanger/images/reverse_button_dark.png');
}

.display {
    background-color: #000;
    color: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
}

.select-input {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 5px;
    border: 2px solid #000000;
    background-color: transparent;
}

.dark .select-input {
    border: 2px solid #9BA8AB;
    background-color: transparent;
}

.currency-select {
    font-size: 20px;
    appearance: none;
    background-color: transparent;
    background-repeat: no-repeat;
    border: none;
    text-align: center;
}

.dark .currency-select {
    color: #fff;
}

.currency-select option {
    color: #6a6868;
}

.flag-icon{
    width: 40px;
    height: 30px;
}