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

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--gray-900);
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.search-section {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#drugInput {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

#drugInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.autocomplete-items,
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    display: none;
}

.autocomplete-items.active,
.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s;
}

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

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--gray-50);
}

.autocomplete-item strong {
    color: var(--primary);
}

.autocomplete-loading {
    padding: 12px 20px;
    text-align: center;
    color: var(--gray-600);
    font-size: 14px;
}

.autocomplete-empty {
    padding: 12px 20px;
    text-align: center;
    color: var(--gray-600);
    font-size: 14px;
    font-style: italic;
}

#searchBtn {
    padding: 14px 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#searchBtn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

#searchBtn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.examples {
    text-align: center;
    color: var(--gray-600);
    font-size: 14px;
}

.example {
    display: inline-block;
    padding: 4px 12px;
    margin: 0 5px;
    background: var(--gray-100);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--primary);
    font-weight: 500;
}

.example:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card h2 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.card h3 {
    color: var(--gray-900);
    margin-bottom: 15px;
    font-size: 1.4rem;
    border-bottom: 2px solid var(--gray-100);
    padding-bottom: 10px;
}

.card h4 {
    color: var(--gray-700);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.card.warning {
    border-left: 4px solid var(--warning);
    background: #fffbeb;
}

.card.error {
    border-left: 4px solid var(--danger);
    background: #fef2f2;
}

.card.info {
    border-left: 4px solid var(--info);
    background: #eff6ff;
}

.drug-details {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--gray-100);
    border-radius: 6px;
    font-size: 14px;
    color: var(--gray-700);
}

.side-effects-list {
    display: grid;
    gap: 8px;
}

.side-effect-item {
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    font-size: 15px;
}

.card.warning .side-effect-item {
    background: #fef3c7;
    border-left-color: var(--warning);
    font-weight: 500;
}

.evidence-item {
    padding: 15px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid var(--success);
}

.evidence-section {
    font-weight: 600;
    color: var(--success);
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.evidence-snippet {
    color: var(--gray-700);
    line-height: 1.6;
    font-style: italic;
}

.source-item {
    padding: 10px 15px;
    background: var(--gray-50);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}

.source-id {
    color: var(--gray-600);
    font-family: monospace;
    font-size: 12px;
}

.disclaimer {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    border-radius: 10px;
    padding: 20px;
    margin-top: 30px;
    line-height: 1.8;
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    padding: 20px;
    opacity: 0.9;
}

footer a {
    color: white;
    text-decoration: underline;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    #searchBtn {
        justify-content: center;
    }
    
    .card {
        padding: 20px;
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#results > * {
    animation: fadeIn 0.5s ease-in-out;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 12px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--gray-700);
}

.tab:hover {
    background: var(--gray-200);
}

.tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-description {
    text-align: center;
    color: var(--gray-600);
    margin-bottom: 20px;
    font-size: 15px;
}

/* Multiple drugs input */
#drugInputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.drug-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.multi-drug-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

.multi-drug-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.remove-drug {
    width: 40px;
    height: 40px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.remove-drug:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.multi-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.add-drug-btn {
    padding: 12px 24px;
    background: var(--gray-100);
    border: 2px solid var(--gray-300);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--gray-700);
}

.add-drug-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
}

.analyze-btn {
    padding: 12px 32px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analyze-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.analyze-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

/* Multiple results */
#multipleResults {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

#multipleResults h3 {
    color: var(--gray-900);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

#multipleResults h4 {
    color: var(--gray-900);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.drugs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 20px;
}

.drug-pill {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.section-description {
    color: var(--gray-700);
    font-size: 15px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.combined-section {
    margin-bottom: 30px;
    background: var(--gray-50);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--success);
}

.combined-section h4 {
    color: var(--gray-900);
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.warning-section {
    background: #fef2f2;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--danger);
}

.warning-note {
    margin-top: 15px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    color: var(--danger);
    font-weight: 600;
    font-size: 14px;
}

.individual-drug {
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 2px solid var(--gray-200);
    border-left: 4px solid var(--primary);
}

.individual-drug h5 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 700;
}

.individual-drug p {
    margin-top: 15px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-900);
}

.individual-drug .side-effects-list {
    margin-top: 10px;
}

.effect-count {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    background: var(--danger);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}
