* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f8f9fa;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

* {
    font-family: 'Twemoji Country Flags', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Move the container to the top because of the phone keyboard */
@media (max-width: 768px) {
    body {
        display: flex;
        align-items: flex-start;
    }
}

.container {
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    padding: 24px;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
}

.title {
    font-size: 28px;
    font-weight: 400;
    color: #202124;
    margin-bottom: 8px;
}

.subtitle {
    color: #5f6368;
    font-size: 14px;
}

.converter-section {
    padding: 24px;
}

.currency-row {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.currency-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid #dadce0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.currency-input-group:focus-within {
    border-color: #1a73e8;
    box-shadow: 0 0 0 1px #1a73e8;
}

.currency-input {
    flex: 1;
    padding: 16px;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
}

.currency-select {
    padding: 16px 12px;
    border: none;
    border-left: 1px solid #dadce0;
    background: #f8f9fa;
    font-size: 14px;
    font-weight: 500;
    color: #1a73e8;
    cursor: pointer;
    outline: none;
    min-width: 80px;
}

.currency-select:hover {
    background: #e8f0fe;
}

.swap-button {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: #5f6368;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    margin: 0 auto;
}

.swap-button:hover {
    background: #f1f3f4;
    transform: rotate(180deg);
}

.swap-icon {
    width: 24px;
    height: 24px;
}

.result-section {
    margin-top: 24px;
    padding: 20px;
    background: #e1f5fe;
    border-radius: 8px;
}

.result-text {
    font-size: 18px;
    color: #202124;
    font-weight: 400;
}

.rate-info {
    margin-top: 8px;
    font-size: 14px;
    color: #5f6368;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error {
    color: #d93025;
    font-size: 14px;
    margin-top: 8px;
}

.last-updated {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: #5f6368;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .container {
        background: #1e1e1e;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    }

    .header {
        background: #1e1e1e;
        border-bottom: 1px solid #333;
    }

    .title {
        color: #ffffff;
    }

    .subtitle {
        color: #aaaaaa;
    }

    .currency-input-group {
        border: 1px solid #444;
        background: #2d2d2d;
    }

    .currency-input-group:focus-within {
        border-color: #4285f4;
        box-shadow: 0 0 0 1px #4285f4;
    }

    .currency-input {
        background: transparent;
        color: #ffffff;
    }

    .currency-input::placeholder {
        color: #777;
    }

    .currency-select {
        background: #333;
        border-left: 1px solid #444;
        color: #ffffff;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 16px;
        padding-right: 28px;
    }

    .currency-select:hover {
        background-color: #444;
    }

    .swap-button {
        color: #aaaaaa;
        background: #333;
    }

    .swap-button:hover {
        background: #444;
        color: #ffffff;
    }

    .result-section {
        background: #0d3446;
    }

    .result-text {
        color: #ffffff;
    }

    .rate-info {
        color: #aaaaaa;
    }

    .error {
        color: #ff6b6b;
    }

    .last-updated {
        color: #777;
    }

    /* Style the dropdown options */
    select option {
        background: #333;
        color: #fff;
    }

    /* Style the number input spinners */
    input[type="number"]::-webkit-inner-spin-button {
        /* Invert the default black arrows to white */
        filter: invert(1);
    }

    /* Style the dropdown scrollbar */
    .currency-select::-webkit-scrollbar {
        width: 8px;
    }

    .currency-select::-webkit-scrollbar-track {
        background: #333;
    }

    .currency-select::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 4px;
    }

    .currency-select::-webkit-scrollbar-thumb:hover {
        background: #666;
    }

    /* For Firefox */
    .currency-select {
        scrollbar-width: thin;
        scrollbar-color: #555 #333;
    }

    /* Style the options scrollbar (for when there are many options) */
    select option {
        scrollbar-width: thin;
        scrollbar-color: #555 #333;
    }
}

/* Extra small devices (phones below 480px width) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    .header,
    .converter-section {
        padding: 16px;
    }

    .title {
        font-size: 22px;
    }

    .subtitle {
        font-size: 12px;
    }

    .currency-input {
        padding: 12px;
        font-size: 14px;
    }

    .currency-select {
        padding: 12px 8px;
        font-size: 12px;
        min-width: 86px;
    }

    .swap-button {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }

    .result-text {
        font-size: 16px;
    }
}

/* Short screens (less than 700px height) */
@media (max-height: 700px) {
    body {
        align-items: flex-start;
    }

    .container {
        margin-top: 10px;
    }
}