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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    color: #1e293b;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    color: #1e293b;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0;
    color: #0f172a;
}

.converter-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
}

.tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.tab-button {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-button:hover {
    color: #334155;
    background: #f1f5f9;
}

.tab-button.active {
    color: #0f172a;
    border-bottom-color: #3b82f6;
    background: #f8fafc;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.input-group input {
    flex: 1;
    padding: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group select {
    padding: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.input-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group select {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.source-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f1f5f9;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    font-size: 0.85rem;
    color: #475569;
}

.source-info small {
    line-height: 1.4;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    color: #555;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: #667eea;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.results-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.measurement-category {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 3px solid #3b82f6;
}

.measurement-category h3 {
    color: #1e293b;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.measurement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.measurement-item:last-child {
    border-bottom: none;
}

.measurement-name {
    font-weight: 500;
    color: #334155;
}

.measurement-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 1.1rem;
}

.conversion-factors {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

.conversion-factors h3 {
    color: #1e293b;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.factor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.factor-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

.factor-item strong {
    color: #1e293b;
    font-weight: 600;
}

.money-item {
    background: #1e293b;
    color: white;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.money-item .money-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.money-item .money-value {
    font-size: 1.1rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group select {
        min-width: auto;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .converter-section,
    .results-section,
    .conversion-factors {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
}

/* Hide optgroups when needed */
optgroup.hidden {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

optgroup.hidden option {
    display: none !important;
}