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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.card {
    background: #ffffff;
    padding: 40px;
    max-width: 900px;
    width: 100%;
    margin: auto;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeIn 0.5s ease-in;
}

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

header {
    border-bottom: 3px solid #4a90e2;
    margin-bottom: 30px;
    padding-bottom: 20px;
    position: relative;
    padding-right: 80px;
}

.history-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

.history-title {
    color: #1e3a8a;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
}

.history-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.history-item:hover {
    border-color: #4a90e2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-drugs {
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.history-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.history-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-badge.alta {
    background: #fee2e2;
    color: #991b1b;
}

.history-badge.moderada {
    background: #fef3c7;
    color: #92400e;
}

.history-badge.baixa {
    background: #dbeafe;
    color: #1e40af;
}

.history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
}

.history-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-arrow {
    color: #64748b;
    font-size: 14px;
}

.empty-history {
    text-align: center;
    padding: 30px;
    color: #64748b;
    font-size: 14px;
}

.view-more-btn {
    display: inline-block;
    padding: 10px 24px;
    background: #f5f7fa;
    color: #2563eb;
    border: 2px solid #2563eb;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.view-more-btn:hover {
    background: #2563eb;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

header::after {
    content: '💊';
    position: absolute;
    right: 45px;
    top: 0;
    font-size: 32px;
    opacity: 0.3;
}

.info-icon {
    position: absolute;
    right: 0;
    top: 0;
    color: #2563eb;
    font-size: 28px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    z-index: 2;
}

.info-icon:hover {
    background: #eff6ff;
    transform: scale(1.1);
    color: #1e40af;
}

header h1 {
    color: #1e3a8a;
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

small {
    color: #64748b;
    font-size: 14px;
    display: block;
    margin-top: 8px;
    font-weight: 500;
}

label {
    display: block;
    color: #1e3a8a;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 8px;
    font-size: 15px;
}

select {
    width: 100%;
    padding: 14px 16px;
    margin-top: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    background: #ffffff;
    color: #1e293b;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e3a8a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

select:hover {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

button:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.search-container {
    position: relative;
    margin-bottom: 20px;
}

#drug-search {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

#drug-search:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s;
    user-select: none;
}

.search-result-item:hover {
    background: #f8f9fa;
}

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

.selected-drugs-container {
    margin-bottom: 20px;
}

.selected-drugs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    min-height: 50px;
    padding: 10px;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    background: #f8f9fa;
}

.drug-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.drug-tag .remove-btn {
    background: rgba(255,255,255,0.3);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
}

.drug-tag .remove-btn:hover {
    background: rgba(255,255,255,0.5);
}

.empty-selection {
    color: #64748b;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

.result {
    margin-top: 25px;
    padding: 20px;
    border-radius: 12px;
    border-left: 5px solid;
    animation: slideIn 0.4s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result strong {
    display: block;
    margin-bottom: 10px;
    font-size: 18px;
}

.result-content {
    margin: 15px 0;
    padding: 12px;
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
}

.result-gravidade {
    font-size: 16px;
    display: block;
    margin-bottom: 8px;
}

.result-content p {
    margin: 10px 0;
    line-height: 1.6;
}

.result-recomendacao {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid rgba(0,0,0,0.1);
}

.result-recomendacao strong {
    display: block;
    margin-bottom: 8px;
}

.result-recomendacao p {
    margin: 0;
    line-height: 1.6;
}

.result-text {
    margin: 10px 0 0 0;
    line-height: 1.6;
}

.alta { 
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #dc2626;
    color: #991b1b;
}

.moderada { 
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    color: #92400e;
}

.baixa { 
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    color: #065f46;
}

.disclaimer {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 20px;
    margin-top: 30px;
    border-radius: 12px;
    font-size: 14px;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
    line-height: 1.6;
}

.disclaimer strong {
    color: #1e3a8a;
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
}

.footer {
    margin-top: 30px;
    font-size: 13px;
    color: #64748b;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    line-height: 1.8;
}

/* Tablets */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .card {
        padding: 30px;
        border-radius: 15px;
    }
    
    header h1 {
        font-size: 28px;
    }
    
    header::after {
        font-size: 28px;
    }
    
    .result strong {
        font-size: 16px;
    }
}

/* Telefones */
@media (max-width: 480px) {
    body {
        padding: 10px 10px 10px 10px;
        align-items: flex-start;
        padding-top: 10px;
    }
    
    .card {
        padding: 20px;
        border-radius: 15px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
        margin-top: 0;
    }
    
    header {
        margin-bottom: 25px;
        padding-bottom: 15px;
    }
    
    header h1 {
        font-size: 24px;
        line-height: 1.2;
    }
    
    header::after {
        font-size: 24px;
        top: -5px;
    }
    
    small {
        font-size: 12px;
        margin-top: 6px;
    }
    
    label {
        margin-top: 18px;
        margin-bottom: 6px;
        font-size: 14px;
    }
    
    select {
        padding: 12px 14px;
        font-size: 14px;
        padding-right: 35px;
        border-radius: 8px;
    }
    
    button {
        padding: 14px;
        margin-top: 20px;
        font-size: 14px;
        border-radius: 8px;
        letter-spacing: 0.3px;
    }
    
    .result {
        margin-top: 20px;
        padding: 16px;
        border-radius: 10px;
    }
    
    .result strong {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .result-content {
        margin: 12px 0;
        padding: 10px;
    }
    
    .result-gravidade {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .result-content p,
    .result-recomendacao p,
    .result-text {
        font-size: 13px;
        line-height: 1.5;
    }
    
    .result-recomendacao {
        margin-top: 12px;
        padding-top: 12px;
    }
    
    .disclaimer {
        padding: 16px;
        margin-top: 25px;
        border-radius: 10px;
        font-size: 13px;
    }
    
    .disclaimer strong {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .footer {
        margin-top: 25px;
        font-size: 12px;
        padding-top: 15px;
        line-height: 1.6;
    }
    
    .search-results {
        max-height: 200px;
    }
    
    .selected-drugs {
        padding: 8px;
    }
    
    .drug-tag {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .history-title {
        font-size: 18px;
    }
    
    .history-item {
        padding: 12px;
    }
    
    .history-drugs {
        font-size: 13px;
    }
    
    .history-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* Telefones pequenos */
@media (max-width: 360px) {
    body {
        padding: 10px 8px 8px 8px;
    }
    
    .card {
        padding: 16px;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    small {
        font-size: 11px;
    }
    
    label {
        font-size: 13px;
    }
    
    select, button {
        font-size: 13px;
        padding: 12px;
    }
    
    .result {
        padding: 14px;
    }
    
    .disclaimer {
        padding: 14px;
        font-size: 12px;
    }
    
    .footer {
        font-size: 11px;
    }
}