:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 20px;
}

/* Reset styles specifically for our converter */
.unit-converter-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif !important;
}

.unit-converter-container {
    font-family: 'Inter', sans-serif;
    background: white;
    color: var(--gray-800);
    line-height: 1.6;
    padding: 20px;
    isolation: isolate; /* Creates a new stacking context */
}

.unit-converter-container .container {
    max-width: 1200px;
    margin: 0 auto;
}

.unit-converter-container .card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.unit-converter-container .card:hover {
    transform: translateY(-5px);
}

.unit-converter-container .card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.unit-converter-container .conversion-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .unit-converter-container .conversion-panel {
        grid-template-columns: 2fr 1fr 2fr 1fr;
        align-items: end;
    }
}

.unit-converter-container .form-group {
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.unit-converter-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-600);
}

/* FIXED: Select and input styles with enhanced specificity */
.unit-converter-container select, 
.unit-converter-container input {
    width: 100% !important;
    padding: 14px 16px !important;
    border: 1px solid var(--gray-200) !important;
    border-radius: 12px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    line-height: 1.5 !important;
    height: auto !important;
    min-height: 50px !important;
    background-color: var(--white) !important;
    transition: all 0.3s !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    color: var(--gray-800) !important;
    font-weight: 400 !important;
    display: block !important;
    box-shadow: none !important;
}

/* Fix for Firefox */
.unit-converter-container select {
    text-indent: 0.01px;
    text-overflow: '';
}

.unit-converter-container select::-ms-expand {
    display: none;
}

.unit-converter-container select:focus, 
.unit-converter-container input:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2) !important;
}

.unit-converter-container input {
    font-weight: 600 !important;
}

.unit-converter-container button {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.unit-converter-container button:hover {
    background-color: var(--primary-dark);
}

.unit-converter-container .result {
    text-align: center;
    margin-top: 30px;
}

.unit-converter-container .result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 10px 0;
}

.unit-converter-container .secondary-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 25px;
}

.unit-converter-container .secondary-result {
    background-color: var(--gray-50);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.unit-converter-container .secondary-value {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 1.2rem;
}

.unit-converter-container .secondary-label {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.unit-converter-container .quick-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.unit-converter-container .preset-btn {
    background-color: var(--gray-100);
    color: var(--gray-800);
    border: none;
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.unit-converter-container .preset-btn:hover {
    background-color: var(--primary);
    color: white;
}

.unit-converter-container .unit-badge {
    display: inline-block;
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
}

/* Custom dropdown arrow */
.unit-converter-container select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    background-size: 16px !important;
    padding-right: 46px !important;
}

/* Ensure options are visible */
.unit-converter-container select option {
    color: var(--gray-800);
    padding: 10px;
    font-size: 16px;
}

/* High specificity override for any theme styles */
body .unit-converter-container select,
body .unit-converter-container input {
    padding: 14px 16px !important;
    line-height: 1.5 !important;
    font-size: 16px !important;
    height: auto !important;
    min-height: 50px !important;
}

/* Print styles for better visibility */
@media print {
    .unit-converter-container select,
    .unit-converter-container input {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: #fff !important;
    }
}