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

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

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1a202c;
}

.container {
    max-width: 1200px;
    padding: 2rem 1rem;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.card:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 2rem;
    text-align: center;
    border-radius: 0 !important;
}

.card-header h1 {
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header p {
    font-weight: 400;
    opacity: 0.9;
    margin: 0;
    font-size: 1.1rem;
}

.card-body {
    padding: 2.5rem;
}

.btn-group {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-group .btn {
    border: none;
    background: #f7fafc;
    color: #4a5568;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    border-radius: 0;
}

.btn-group .btn:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.btn-group .btn-check:checked + .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.form-label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #2d3748;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    display: block;
}

.form-control::placeholder {
    color: #a0aec0;
    font-weight: 400;
    text-align: left;
    opacity: 1;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    background: white;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
    will-change: transform, box-shadow;
}

.btn-primary:hover {
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.btn-primary:active {
    transform: translateY(-1px) translateZ(0);
}

.border rounded {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.border rounded::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.border rounded:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

.border rounded:hover::before {
    transform: scaleX(1);
}

#results {
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fs-4 {
    font-size: 2.5rem !important;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fs-5 {
    font-size: 1.5rem !important;
    font-weight: 600;
}

.text-success {
    color: #38a169 !important;
}

.text-warning {
    color: #d69e2e !important;
}

.text-danger {
    color: #e53e3e !important;
}

.chemical-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.chemical-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.chemical-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 1rem 1.5rem;
}

.chemical-card .card-body {
    padding: 1.5rem;
}

.chemical-card .row {
    align-items: stretch;
}

.chemical-card .col-md-4 {
    display: flex;
    padding: 0.5rem;
}

.dose-item {
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.8);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 120px;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.dose-item:hover {
    background: rgba(241, 245, 249, 0.9);
}

.dose-item h6 {
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 600;
}

.dose-item p {
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.dose-item small {
    display: block;
    margin-top: auto;
    font-size: 0.7rem;
    line-height: 1.3;
}

.dose-item:hover {
    background: rgba(241, 245, 249, 0.9);
    transform: translateY(-2px);
}

.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.alert-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    color: #2d3748;
    font-weight: 500;
    padding: 1.25rem;
}

.card-header.bg-success {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%) !important;
}

h6.text-muted {
    color: #718096 !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-size: 0.875rem;
}

small.text-muted {
    color: #a0aec0 !important;
    font-weight: 500;
}

.mb-4 {
    margin-bottom: 2rem !important;
}

.mb-3 {
    margin-bottom: 1.5rem !important;
}

.row {
    margin: 0;
}

.col-md-6 {
    padding: 0.75rem;
}

.col-md-6 .form-control {
    width: 100%;
}

.mb-3 .form-control {
    width: 100%;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 0.5rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .card-header {
        padding: 1.5rem;
    }
    
    .card-header h1 {
        font-size: 1.5rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    .fs-4 {
        font-size: 2rem !important;
    }
    
    .fs-5 {
        font-size: 1.25rem !important;
    }
    
    .chemical-card .row {
        flex-direction: column;
    }
    
    .chemical-card .col-md-4 {
        width: 100%;
        padding: 0.5rem 0;
        display: block;
    }
    
    .dose-item {
        min-height: auto;
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .dose-item h6 {
        min-height: auto;
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    .dose-item p {
        font-size: 1rem;
    }
    
    .dose-item small {
        font-size: 0.65rem;
    }
}

/* Performance optimizations - minimal for Chrome */
.card {
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: box-shadow 0.2s ease;
}

.chemical-card {
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: box-shadow 0.2s ease;
}

.dose-item {
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: background 0.2s ease;
}

.form-control {
    transform: translateZ(0);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    transform: translateZ(0);
    transition: background 0.2s ease;
}

/* Chrome-specific optimizations */
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {
    .card {
        transform: none;
        transition: box-shadow 0.15s ease;
    }
    
    .chemical-card {
        transform: none;
        transition: box-shadow 0.15s ease;
    }
    
    .dose-item {
        transform: none;
        transition: background 0.15s ease;
    }
    
    .form-control {
        transform: none;
        transition: border-color 0.15s ease;
    }
    
    .btn-primary {
        transform: none;
        transition: background 0.15s ease;
    }
    
    /* Disable backdrop-filter for Chrome */
    .card, .chemical-card {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.98);
    }
}

/* Remove duplicate performance rules */
/* Loading animation */
.form-control:invalid:not(:placeholder-shown) {
    border-color: #fc8181;
    background: rgba(252, 129, 129, 0.05);
}

.form-control:valid:not(:placeholder-shown) {
    border-color: #48bb78;
    background: rgba(72, 187, 120, 0.05);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}
