/* Main Container */
.dosage-calculator {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 11px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 3px solid #e0e6ed;
}

/* Title Bar Layout */
.title-bar {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 600px;
    margin-bottom: 1.5rem;
}

.title-bar-column {
    display: flex;
    align-items: center;
}

.logo-column {
    justify-content: flex-start;
}

.title-column {
    justify-content: flex-end;
}

.calculator-logo {
    height: 50px;
    width: auto;
    max-width: 100%;
}

.calculator-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: right;
}

/* Medicine Selection */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-size: 0.95rem;
    color: #5a6a7d;
    margin-bottom: 0.5rem;
    font-weight: 500;
    display: block;
}

.dropdown-select, .search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

/* Search Results */
.search-results {
    display: none;
    position: absolute;
    width: calc(100% - 2rem);
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.search-result {
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f2f5;
    color: #2c3e50; /* Added for better text visibility */
}

/* NEW: Style for highlighted search result (keyboard navigation) */
.search-result.active {
    background-color: #0a4c60;
    color: white;
}
.search-result:hover,
.search-result:focus {
    background-color: #3498db; /* Blue background */
    color: white; /* White text */
    outline: none; /* Remove default focus outline */
}

/* Medicine Info Container */
.medicine-info-container {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e0e6ed;
    display: none;
}

.medicine-description-container {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1.5rem;
    align-items: start;
}

.medicine-description {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
}

.medicine-description-item {
    display: contents;
}

.first-description-line {
    grid-column: 1 / -1;
    margin-bottom: 0.8rem;
    color: #4a5568;
    font-style: italic;
    border-bottom: 1px solid #e0e6ed;
    padding-bottom: 0.5rem;
}

.salt-name {
    font-weight: 600;
    color: #2c3e50;
    text-align: right;
    padding-right: 1rem;
}

.salt-value {
    font-weight: 400;
    color: #4a5568;
    text-align: left;
    border-left: 1px dashed #d1d9e6;
    padding-left: 1rem;
}

.medicine-image {
    position: relative;
    text-align: center;
}

.clickable-medicine-image {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 8px;
    border: 2px solid #e0e6ed;
    padding: 5px;
    transition: all 0.3s ease;
}

.clickable-medicine-image:hover {
    border-color: #3498db;
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* Calculator Fields */
.calculator-fields {
    margin-top: 1.5rem;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid #e0e6ed;
    display: none;
}

.input-group {
    margin-bottom: 1.2rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #5a6a7d;
    font-weight: 500;
    font-size: 0.95rem;
}

.rounded-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

/* Hide number input arrows */
.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.no-spinner {
    -moz-appearance: textfield;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.btn {
    flex: 1;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #f1f5f9;
    color: #4a5568;
    border: 1px solid #d1d9e6;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Results */
.results-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e0e6ed;
    display: none;
}

.result-line {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #e0e6ed;
}

.result-label {
    display: block;
    color: #2e7d32;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.result-value {
    color: #d32f2f;
    font-weight: 600;
    font-size: 1.1rem;
}

.error {
    color: #e53e3e;
    font-weight: 500;
}

/* Disclaimer */
.dosage-disclaimer {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 4px solid #dc3545;
    border-radius: 4px;
    font-size: 0.9em;
    color: #6c757d;
}

.disclaimer-title {
    margin-top: 0;
    margin-bottom: 10px;
    color: #dc3545;
    font-size: 1.1em;
}

.disclaimer-list {
    margin: 0;
    padding-left: 20px;
}

.disclaimer-list li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dosage-calculator {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .title-bar {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .title-column {
        justify-content: center;
        text-align: center;
    }
    
    .logo-column {
        justify-content: center;
    }
    
    .calculator-title {
        text-align: center;
    }
    
    .medicine-description-container {
        grid-template-columns: 1fr;
    }
    
    .medicine-description {
        grid-template-columns: 1fr;
    }
    
    .salt-name, .salt-value {
        text-align: left;
        padding: 0;
        border-left: none;
    }
    
    .salt-name {
        margin-top: 0.5rem;
    }
    
    .salt-value {
        margin-bottom: 0.5rem;
        padding-left: 1rem;
    }
    
    .clickable-medicine-image {
        max-height: 150px;
        margin-top: 1rem;
    }
    
    .calculator-logo {
        height: 40px;
    }
}

@media (max-width: 480px) {
    .calculator-logo {
        height: 35px;
    }
    
    .calculator-title {
        font-size: 1.5rem;
    }
    
    .button-group {
        flex-direction: column;
    }
}