* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    padding: 20px;
    color: #333;
    line-height: 1.6;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2rem;
}

h2 {
    color: #34495e;
    margin: 20px 0 10px;
    font-size: 1.5rem;
}

h3 {
    color: #2980b9;
    font-size: 1.2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 1rem;
}

th {
    background: #3498db;
    color: #fff;
    font-weight: bold;
}

tr:nth-child(even) {
    background: #f9f9f9;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ddd;
}

.tab-button {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1rem;
    transition: background 0.3s, transform 0.2s;
}

.tab-button:hover {
    background: #bdc3c7;
    transform: translateY(-2px);
}

.tab-button.active {
    background: #3498db;
    color: #fff;
}

.tab-button + button {
    margin-left: 5px;
    background: #e74c3c;
    color: #fff;
    padding: 5px 10px;
    font-size: 0.9rem;
}

#searchResults, #formulationDetails, #customIngredientForm, #notesSection {
    margin: 10px 0;
}

#searchResults div, #customIngredientsList div, #allIngredientsList div {
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #fff;
    border-radius: 5px;
    margin: 5px 0;
}

.error {
    color: #e74c3c;
    font-weight: bold;
    background: #ffe6e6;
    border-radius: 5px;
}

.form-section, .notes-section {
    background: #fff;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

button {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

button:hover {
    background: #2980b9;
}

input, textarea, select {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

textarea {
    height: 100px;
    resize: vertical;
}

label {
    display: block;
    margin: 10px 0 5px;
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    background: #fff;
    margin: 10% auto;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close {
    float: right;
    cursor: pointer;
    font-size: 1.5rem;
    color: #e74c3c;
}

#customIngredientsList, #allIngredientsList {
    max-height: 200px;
    overflow-y: auto;
}

#ingredientSuggestions {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 150px;
    overflow-y: auto;
    width: calc(100% - 20px);
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: none;
}

#ingredientSuggestions div {
    padding: 8px;
    cursor: pointer;
}

#ingredientSuggestions div:hover {
    background: #f0f0f0;
}

#newIngredientContainer {
    position: relative;
}

tfoot {
    font-weight: bold;
    background: #ecf0f1;
}

.info-icon {
    position: relative;
    display: inline-block;
    cursor: help;
    font-size: 1.2rem;
    color: #3498db;
    margin-left: 10px;
}

.tooltip {
    visibility: hidden;
    width: 300px;
    background-color: #fff;
    color: #333;
    text-align: left;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: absolute;
    z-index: 1000;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.9rem;
    line-height: 1.4;
}

.info-icon:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1rem; }
    th, td { font-size: 0.9rem; padding: 8px; }
    .tab-button { padding: 8px 12px; font-size: 0.9rem; }
    button { padding: 8px 12px; font-size: 0.9rem; }
    input, textarea, select { font-size: 0.9rem; }
    .modal-content { margin: 15% auto; padding: 15px; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.2rem; }
    h2 { font-size: 1rem; }
    table, th, td { font-size: 0.8rem; padding: 6px; }
    .tabs { flex-direction: column; }
    .tab-button { width: 100%; margin: 5px 0; }
    .form-section, .notes-section { padding: 10px; }
    button { width: 100%; margin: 5px 0; }
}