:root {
    --primary: #27ae60; /* Green for "Go/Convert" feel */
    --accent: #2ecc71;
    --bg: #f8f9fa;
    --text: #333;
    --white: #ffffff;
    --border: #ddd;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    padding: 20px;
}

header, footer {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: var(--primary);
    margin-bottom: 10px;
}

#app {
    max-width: 500px;
    margin: 0 auto;
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    margin-bottom: 25px;
    background: #f1f2f6;
    padding: 10px;
    border-radius: 8px;
}

.nav-btn {
    flex: 1 1 auto;
    min-width: 100px; /* Ensure readability */
    border: none;
    background: transparent;
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #7f8c8d;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.converter-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #7f8c8d;
    margin-bottom: 5px;
}

input[type="number"] {
    padding: 15px;
    font-size: 1.5rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    width: 100%;
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    border-color: var(--accent);
    outline: none;
}

.unit-selectors {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.select-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent flex overflow */
}

select {
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    width: 100%;
}

#btn-swap {
    flex: 0 0 40px;
    height: 44px; /* Match select height roughly */
    border: 1px solid var(--border);
    background: #f1f2f6;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#btn-swap:hover {
    background: #e1e2e6;
}

.result-box {
    background: #f1f9f4; /* Light green tint */
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-top: 10px;
    border: 1px solid #d4efdf;
}

.result-box .label {
    display: block;
    font-size: 0.9rem;
    color: #27ae60;
    margin-bottom: 5px;
}

.result-box .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    word-break: break-all;
}

@media (max-width: 400px) {
    .category-nav {
        flex-wrap: wrap;
    }
    .nav-btn {
        flex: 1 1 45%;
    }
}
