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

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: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    max-width: 1000px;
    width: 100%;
}

h1 {
    color: #333;
    margin-bottom: 2rem;
    text-align: center;
}

.header-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1.5fr 1.5fr 1.5fr 40px;
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1rem;
}

.ingredient-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1.5fr 1.5fr 1.5fr 40px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    align-items: center;
    transition: all 0.2s;
}

.field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-label {
    display: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
}

.ingredient-row:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

input[type="text"],
input[type="number"] {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
    width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.calculated-protein,
.calculated-calories {
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.remove-btn {
    background: #ff4757;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: #ff3838;
    transform: scale(1.1);
}

.add-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    margin: 1.5rem 0;
    width: 100%;
    transition: all 0.2s;
    font-weight: 600;
}

.add-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.total-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.total-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.total-item h2 {
    color: white;
    font-size: 1.2rem;
    margin: 0;
}

.total-value {
    background: white;
    color: #667eea;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.8rem;
    font-weight: 700;
    min-width: 150px;
    text-align: center;
}

.actions-section {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.save-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.save-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.saved-forms-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
}

.saved-forms-section h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

#saved-forms-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.no-recipes {
    text-align: center;
    color: #999;
    padding: 2rem;
    font-style: italic;
}

.saved-form-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.saved-form-card:hover {
    background: #f0f0f0;
    border-color: #667eea;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.saved-form-info {
    flex: 1;
}

.saved-form-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.saved-form-details {
    font-size: 0.9rem;
    color: #666;
}

.saved-form-actions {
    display: flex;
    gap: 0.75rem;
}

.load-btn,
.delete-btn {
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-weight: 600;
}

.load-btn {
    background: #667eea;
    color: white;
}

.load-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.delete-btn {
    background: #e0e0e0;
    color: #666;
}

.delete-btn:hover {
    background: #ff4757;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

@media (max-width: 768px) {
    .header-row,
    .ingredient-row {
        grid-template-columns: 1fr;
    }

    .header-row {
        display: none;
    }

    .ingredient-row {
        gap: 0.5rem;
    }

    .mobile-label {
        display: block;
    }

    .remove-btn {
        width: 100%;
        height: 40px;
    }

    .total-section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .saved-form-card {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .saved-form-actions {
        width: 100%;
    }

    .load-btn,
    .delete-btn {
        flex: 1;
    }
}
